ngBind
(directive in module ng
)
The ngBind
attribute tells Angular to replace the text content of the specified HTML element
with the value of a given expression, and to update the text content when the value of that
expression changes.
Typically, you don't use ngBind
directly, but instead you use the double curly markup like
{{ expression }}
which is similar but less verbose.
Once scenario in which the use of ngBind
is prefered over {{ expression }}
binding is when
it's desirable to put bindings into template that is momentarily displayed by the browser in its
raw state before Angular compiles it. Since ngBind
is an element attribute, it makes the
bindings invisible to the user while the page is loading.
An alternative solution to this problem would be using the
ngCloak
directive.
<ANY ng-bind="{expression}"> ... </ANY>as class
<ANY class="ng-bind: {expression};"> ... </ANY>
ngBind – {expression} –
Expression to evaluate.
Enter a name in the Live Preview text box; the greeting below the text box changes instantly.