Please enable Javascript to correctly display the contents on Dot Net Tricks!

Expressions

Posted On : 05 Feb 2015
Updated On : 10 Feb 2015
Total Views : 5152

AngularJS expressions are much like JavaScript expressions, placed inside HTML templates by using double braces such as: {{expression}}. AngularJS evaluates expressions and then dynamically adds the result to a web page. Like JavaScript expressions, they can contain literals, operators, and variables.

There are some valid AngularJS expressions:

  1. {{ 1 + 2 }}

  2. {{ x + y }}

  3. {{ x == y }}

  4. {{ x = 2 }}

  5. {{ user.Id }}

Angular Expressions with Example

AngularJS Expressions

How AngularJS expressions are different from the JavaScript expressions

AngularJS expressions are much like JavaScript expressions but they are different from JavaScript expressions in the following ways:

  1. Angular expressions can be added inside the HTML templates.

  2. Angular expressions doesn't support control flow statements (conditionals, loops, or exceptions).

  3. Angular expressions support filters to format data before displaying it.

What do you think?

I hope you have better understanding of Expressions in AngularJS. I would like to have feedback from my blog readers. Your valuable feedback, question, or comments about this article are always welcome.