angular.directive.ng:selected

Work in Progress This page is currently being revised. It might be incomplete or contain inaccuracies.

Description

The HTML specs do not require browsers to preserve the special attributes such as selected. (The presence of them means true and absence means false) This prevents the angular compiler from correctly retrieving the binding expression. To solve this problem, we introduce ng:selected.

Usage

<ANY ng:selected="template">
   ...
</ANY>

Parameters

Example

  Check me to select: <input type="checkbox" name="checked"><br/>
  <select>
    <option>Hello!</option>
    <option id="greet" ng:selected="{{checked}}">Greetings!</option>
  </select>
  it('should select Greetings!', function() {
    expect(element('.doc-example-live #greet').prop('selected')).toBeFalsy();
    input('checked').check();
    expect(element('.doc-example-live #greet').prop('selected')).toBeTruthy();
  });