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 preserve the special attributes such as selected.(The presense of them means true and absense 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').attr('selected')).toBeFalsy();
    input('checked').check();
    expect(element('.doc-example-live #greet').attr('selected')).toBeTruthy();
  });