angular.module.ng.$compileProvider.directive.ng-readonly

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

as attribute
<INPUT ng-readonly
     expression="{string}">
   ...
</INPUT>

Parameters

Example

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