In AngularJS, any inline javascript code that included in HTML templates doesn't work
jQlite does not support script tags. jQuery does, so the recommendation is to include jQuery if you need this functionality.
From Angular's Igor Minar in this discussion:
we looked into supporting script tags in jqlite, but what needs to be
done to get a cross-browser support involves a lot of black magic. For
this reason we decided that for now we are just going to recommend
that users use jquery along with angular in this particular case. It
doesn't make sense for us to rewrite one third of jquery to get this
working in jqlite.
Here's the related github issue jqLite should create elements in same way as jQuery where Igor sums up, before closing the issue, with this:
This is too much craziness for jqlite, so we are not going to do it.
Instead we are going to document that if you want have script elements
in ng:include or ng:view templates, you should use jquery.
demo plunker with jquery
script not working with AngularJS
jQuery Library must stand before AngularJS library in declaration. This has solved my problem
Using inline code from database
In addition to the restructures mentioned by @31piy & @Wes H, it turns out the final step is to use $compile
with a directive. Solution found here: Compiling dynamic HTML strings from database
How do I connect my AngularJS template HTML files to the main Javascript file loaded in the main page so that the ng-controller directives are found?
The problem was that I wasn't specifying the app.
Adding the attribute ng-app="WebApp" before the ng-controller attribute fixed the problem:
<form ng-app="WebApp" ng-controller="AgentLoginCtrl" name="userForm" style="width: 300px; background-color: white; border: 2px solid rgb(142, 169, 222); padding: 0px 5px 5px 5px">
Related Topics
How to Disable the Save Password Bubble in Chrome Using JavaScript
Change Svg Fill Color in :Before or :After CSS
Jquery Mobile Prevent Scroll-To-Top Before Page Transition
Fcm - Programmatically Send Push Notification to User Segments
How to Detect the Screen Resolution with JavaScript
How Does Sort Function Work in JavaScript, Along with Compare Function
Angularjs- Login and Authentication in Each Route and Controller
Can JavaScript Access a Filesystem
When Using Jquery On(), Why Use (Document) VS. the Element Itself
How to Retain the Scroll Position of a Scrollable Area When Pressing Back Button
Ios8 Safari After a Pushstate the :Nth-Child() Selectors Not Works
Perspective Transform of Svg Paths (Four Corner Distort)
How to Use Materialize-CSS with Angular
How Does Linux Emulator in JavaScript by Fabrice Bellard Work