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 ExampleTest it NowNote: If you remove the directive "ng-app", HTML will display the expression without solving it. See this example: Test it NowYou 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: Test it NowAngularJS NumbersAngularJS numbers are similar to JavaScript numbers. Test it NowWe can use the same example by using ng-bind: See this example: Test it NowAngularJS StringsTest it NowSame example with ng-bind: Test it NowAngularJS ObjectsTest it NowSame example with ng-bind: Test it NowAngularJS ArraysTest it NowSame example with ng-bind: Test it NowDifference between AngularJS Expressions and JavaScript expressions:
Similarity between AngularJS Expressions and JavaScript expressions:
Next TopicAngularJS Directives |