An expression is used for application data binding to HTML. Expressions are written in double brackets just like {{expression}}}. The behavior in an expression is the same as the ng-bind instruction method. ANGULARJS application expressions are pure JavaScript expressions and output the data they are using there.
Angularjs expression format: {{expression}}
Angularjs expressions can be strings, numbers, operators, and variables
Numeric operation {{1 + 5}}}
String Connection {' abc ' + ' BCD '}}
Variable operation {{firstName + "" + LastName}}, {{quantity * cost}}
Object {{Person.lastname}}}
Array {{points[2]}}
Angularjs Example
1.ANGULARJS Digital
<div ng-app= "" ng-init= "quantity=2;cost=5" >
<p> Total Price: {quantity * cost}}</p>
Previous example output:
Total Price: 10
Code comments:
ng-init= "quantity=2;cost=5"//equivalent to the Var quantity=2,cost=5 in JavaScript;
Use Ng-bind to achieve the same functionality
<div ng-app= "" ng-init= "quantity=1;cost=5" >
<p> Total Price: <span ng-bind= "quantity * cost" ></span ></p>
//The ng-bind here is equivalent to specifying a span of innerHTML
2.Angularjs string
<div ng-app= "" ng-init= "firstname= ' John '; lastname= ' Snow '" >
<p> Name: {{firstName + "" + lastName}}</p >
Output
Name: Jone Snow
3. Angularjs Object
<div ng-app= "ng-init=" person={firstname: ' John ', lastName: ' Snow '} ' >
<p> last name is {{Person.lastname}} </p>
Output
Last Name is Snow
4.AngularJS Array
<div ng-app= "" ng-init= "points=[1,15,19,2,40]" >
<p> The third value is {{points[2]}}</p>
</div>
Output
The third value is 19
The above is a small set to introduce the introduction of the Angularjs introductory course of the ANGULARJS expression of the relevant introduction, I hope to help you!