angular.directive.ng:bind

Description

The ng:bind 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 ng:bind directly, but instead you use the double curly markup like {{ expression }} and let the Angular compiler transform it to <span ng:bind="expression"></span> when the template is compiled.

Usage

<ANY ng:bind="expression">
   ...
</ANY>

Parameters

Example

Enter a name in the Live Preview text box; the greeting below the text box changes instantly.

    <script>
      function Ctrl() {
        this.name = 'Whirled';
      }
    </script>
    <div ng:controller="Ctrl">
      Enter name: <input type="text" ng:model="name"> <br/>
      Hello <span ng:bind="name"></span>!
    </div>
  
    it('should check ng:bind', function() {
      expect(using('.doc-example-live').binding('name')).toBe('Whirled');
      using('.doc-example-live').input('name').enter('world');
      expect(using('.doc-example-live').binding('name')).toBe('world');
    });