angular.directive.ng:disabled

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

Description

The following markup will make the button enabled on Chrome/Firefox but not on IE8 and older IEs:

<div ng:init="scope = { isDisabled: false }">
 <button disabled="{{scope.isDisabled}}">Disabled</button>
</div>

The HTML specs do not require browsers to preserve the special attributes such as disabled. (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:disabled.

Usage

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

Parameters

Example

  Click me to toggle: <input type="checkbox" name="checked"><br/>
  <button name="button" ng:disabled="{{checked}}">Button</button>
  it('should toggle button', function() {
    expect(element('.doc-example-live :button').attr('disabled')).toBeFalsy();
    input('checked').check();
    expect(element('.doc-example-live :button').attr('disabled')).toBeTruthy();
  });