AngularJS ExpressionsIn AngularJS, expressions are used to bind application data to HTML. AngularJS resolves the expression, and return the result exactly where the expression is written. Expressions are written inside double braces {{expression}}.They can also be written inside a directive: AnularJS expressions are very similar to JavaScript expressions. They can contain literals, operators, and variables. For example: AngularJS Expressions ExampleNote: If you remove the directive "ng-app", HTML will display the expression without solving it. See this example: You can also write expressions wherever you want, AngularJS will resolve the expression and return the result. Let's take an example to change the color of input box by changing its value. See this example: AngularJS NumbersAngularJS numbers are similar to JavaScript numbers. We can use the same example by using ng-bind: See this example: AngularJS StringsSame example with ng-bind: AngularJS ObjectsSame example with ng-bind: AngularJS ArraysSame example with ng-bind: Difference between AngularJS Expressions and JavaScript expressions:
Similarity between AngularJS Expressions and JavaScript expressions:
Next TopicAngularJS Directives
|