Thursday, February 18, 2016

AngularJS Expressions

AngularJS Expressions are used to bind data to HTML and can be written in side double curly braces {{2+2}} and in can also be written in directives like ng-bind=”2+2”.

<div ng-app="">
  <p> Angular Expression: {{ 10 + 20 }}</p>
</div>

AngularJS Expressions are very similar to JavaScript Expressions but there are some differences.

  • Both support literals, operators, and variables.
  • Angular expressions support filters, while JavaScript expressions do not.
  • Angular expressions can be written inside HTML but we can not write JavaScript expressions inside HTML.
  • JavaScript expressions support conditionals, loops, and exceptions, while Angular expressions do not support this.


No comments:

Post a Comment