AngularJS Expressions

  • AngularJS expressions are used to bind data to HTML like ng-bind directive
  • AngularJS expressions are similar to JavaScript expressions
  • Expressions are written inside double braces {{ expression }}
  • Expression can be written as one time binding
  • You can write expressions on
    • Numbers
    • Strings
    • Objects
    • Arrays

AngularJS Expressions vs. JavaScript Expressions

  • You cannot use conditionals, loops, or exceptions in AngularJS
  • You cannot declare functions in an AngularJS expression
  • You can use filters in AngularJS expression, which is not available in JavaSript expressions
  • JavaScript expressions are evaluated global (document level), where AngularJS expression are evaluated against $scope object.