May 08, 2021 AngularJS
AngularJS is a JavaScript framework. It can be added to an HTML page by using the hashtag.
AngularJS extends HTML through the directive and binds data to HTML through expressions.
AngularJS is a JavaScript framework. It is a library written in JavaScript.
AngularJS is published as a JavaScript file and can be added to a Web page via the script tab:
We recommend putting the script at the bottom of the element.
This increases the speed at which web pages load because HTML loads are not subject to script loading. |
AngularJS extends HTML with ng-directives.
The ng-app directive defines an AngularJS application.
The ng-model directive binds element values, such as those of an input field, to an application.
The ng-bind directive binds application data to HTML views.
Examples:
When the page is loaded, AngularJS turns on automatically.
The ng-app directive tells AngularJS that the element is the "owner" of the AngularJS application.
The ng-model instruction binds the value of the input field to the application variable name.
The ng-bind instruction binds the application variable name to the innerHTML of a paragraph.
If you remove the ng-app instruction, HTML displays the expression directly and does not evaluate the result of the expression. |
"AngularJS is HTML specifically designed for applications."
AngularJS makes it easier to develop modern single-page applications (SPAs: Single Page Applications).
As you can see, the AngularJS directive is an HTML property with ng as the prefix.
The ng-init instruction initializes the AngularJS application variable.
HTML5 allows extended (homemade) properties,
starting with data-.
The AngularJS property starts with ng- but you can use data-ng- to make the page valid for HTML5. |
With valid HTML5:
The AngularJS expression is written in double braces: .
The AngularJS expression binds data to HTML, which is similar to the ng-bind instruction.
AngularJS "outputs" the data where the expression is written.
AngularJS expressions are much like JavaScript expressions: they can contain text, operators, and variables.
Examples .