Dart Documentationangular.directiveNgBindDirective

NgBindDirective class

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.

It is preferrable to use ngBind instead of {{ expression }} when a template 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.

@NgDirective(
 selector: '[ng-bind]',
 map: const {'ng-bind': '=>value'})
class NgBindDirective {
 dom.Element element;

 NgBindDirective(dom.Element this.element);

 set value(value) => element.text = value == null ? '' : value.toString();
}

Constructors

new NgBindDirective(Element element) #

Creates a new Object instance.

Object instances have no meaningful state, and are only useful through their identity. An Object instance is equal to itself only.

docs inherited from Object
NgBindDirective(dom.Element this.element);

Properties

Element element #

dom.Element element

dynamic set value(value) #

set value(value) => element.text = value == null ? '' : value.toString();