AngularJS expressions and example code, angularjs expressions
I have learned about the basic usage of AngularJS. Here I will learn about the expressions in PDF.
Expressions in AngularJS are not exactly the same as those in js.
First, its expression must be placed in {} before it can be used. Second, compared with the expression concept in javascript, it has the following differences:
1. different scopes
In javascript, the default function is window, but it is different in angularJs. It uses $ scope control.
2. undefined values are allowed.
In angularjs, if an undefined expression is used, no error will occur and a null value will be returned directly.
3. Filter
You can use the | pipeline command in an expression to add a filter, which is similar to the UNIX command line.
4 $ symbol
It is used to distinguish angular methods from user-defined methods.
The following is a small piece of code:
<!doctype html>
Trigger the reset method through reset to reset the content of the name variable;
The undefined test is referenced in the expression, but no error is reported. It is displayed as null by default. -- {test }}
Finally, use the filter to convert the name value in the expression to uppercase. -- {Name | uppercase }}
Running result:
The above is to sort out the AngularJS expression information, and continue to add relevant information in the future. Thank you for your support!