Thursday, December 19, 2013

disabling a form field in AngularJS implementations

An Angular Scope variable like so:

$scope.disabledFlag = true;

 
 

...could be used to drive a disabled state like so:

<input class="form-control" type="text" ng-model="name" required
   ng-disabled="{{disabledFlag}}" />

 
 

In my scenario I have one template driving the CRUD screens for both editing and creating, but I don't want every field to be editable when editing.

No comments:

Post a Comment