This article mainly talks about the details of the use of expressions in angularjs, as well as the use of numbers, arrays, and strings in angularjs. Let us take a look at this article together.
AngularJS uses Expression to bind data to HTML .
AngularJS expressions are written within double curly braces: {{ expression }}.
AngularJS expressions bind data to HTML, which is similar to the ng-bind directive.
AngularJS will "output" data where the expression is written.
AngularJS expressions are much like JavaScript expressions: they can contain literals, operators, and variables.
Instance{{ 5 5 }} or {{ firstName " " lastName }}
AngularJS Number
AngularJS Number Like JavaScript numbers:
AngularJS Example
Total price: {{ quantity * cost }}
Same example using ng-bind:
##
Total price: < ;/p>
Using ng-init is not very common. You'll learn a better way to initialize data in the Controllers chapter. |
Name: { { firstName " " lastName }}
Same instance using ng-bind:
Name:
AngularJS Development Manual to learn)
AngularJS object:AngularJS Example
##
The last name is {{ person.lastName }}
AngularJS Example
Last name is
AngularJS arrays
AngularJS Example
The third value is {{ points[2] }}
The same instance using ng-bind:
The third value is
AngularJS expressions and JavaScript expressions
AngularJS User Manual to learn). If you have any questions, you can leave a message below.
The above is the detailed content of How to use AngularJS expressions? Detailed explanation of the use of expressions in angularjs. For more information, please follow other related articles on the PHP Chinese website!