Reference Angularjs
Need to use ANGULARJS, need to reference Angularjs file
Ng-app
To use angular for page binding, we need to indicate its scope.
In, ng-app= "" means that we are now demonstrating the scope of the angular within the <div> tag. Of course we can also write "ng-app=" on the <body> label. Which tag is written, our angular syntax is supported.
Next, let's look at the effect
It can be seen that the {{,<div>}} is parsed into 4, and the {{* * *}} Outside <div> is output as is.
An expression
In the angular syntax, the contents of {{}} are expressions and can be processed as generic JavaScript syntax.
Binding
We add a <input> on the page, and what you want to <input> enter, what the {{}} expression will show.
Look at the effect
You can see what is entered in the text box, and the contents of the text box are displayed after "Hello", which is the binding in angular
Where the value of Ng-model is the equivalent of defining a variable named name. If the variable does not exist, it is created. The value of the variable is bound on the value of the current <input> tag's values.
{{name}} means to read the value of the variable name that corresponds to Ng-model, which is <input> value.
Example
Add 2 CSS styles to the HTML page, showing red and green, respectively.
Bind the <span> class property to the value of the text box, and now we enter Red,green in the text box to see the effect
Original blog, without permission, please do not reprint.
Once five minutes AngularJS (1)--binding