Expressions are used to bind application data directly into the HTML view.
They are written inside double curly braces, like this: {{ expression }}.
AngularJS expressions function similarly to standard JavaScript expressions.
They can contain literal values, variables, basic math, and operators.
When the application runs, the expression is evaluated and replaced with the result.
You can place expressions anywhere inside your HTML body.
If your model data changes, the expression output updates instantly.
This automatic updating is what makes AngularJS so incredibly fast to develop with!
<div ng-app="" ng-init="price=5; quantity=10">
<p>Basic Math: 5 + 5 = {{ 5 + 5 }}</p>
<p>Total Cost: {{ price * quantity }}</p>
</div>
Because expressions render data dynamically, bots may see empty {{ }} brackets at first.
To prevent this "flicker" and improve user experience, use the ng-bind directive for critical SEO text.
Always ensure important keywords are present in the static HTML when possible.
Which syntax is used to define an AngularJS expression in your HTML?