angular.directive.ng:readonly

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 readonly. (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:readonly.

Usage

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

Parameters

Example

  Check me to make text readonly: <input type="checkbox" name="checked"><br/>
  <input type="text" ng:readonly="{{checked}}" value="I'm Angular"/>
  it('should toggle readonly attr', function() {
    expect(element('.doc-example-live :text').attr('readonly')).toBeFalsy();
    input('checked').check();
    expect(element('.doc-example-live :text').attr('readonly')).toBeTruthy();
  });