Read only entries in AngularJS

advertisements

I have some problem with readonly inputs on agularjs. I have some select which changes readonly inputs values by script. But when I try to output those values by ng-model in the table as {{ng-model}} it doesn't show.

<select name="well" onChange="Update(this.value)" ng-model="well" required>
<option value="Well-01">Well-01</option>
<option value="Well-02">Well-02</option>
<option value="Well-03">Well-03</option>
</select>
<label>Region:</label>
<input type="text" name="region" value="South" ng-model="region" disabled>
<label>State:</label>
<input type="text" name="state" value="Oklahoma" ng-model="state"  disabled>
<label>Field Office:</label>
<input type="text" name="office" value="Ringwood" ng-model="office" disabled>

Fiddle: http://jsfiddle.net/NKyps/7/

It show {{well}} when I change it but doesn't show inputs. Thanks for help. PS: also if someone knows how to use default option (for example: well-01) so inputs will be filled when document is loaded?


I think the problem is those attriboutes aren't binding in some model. When you use {{variable}} angular expect this are binding with some model.

I added as scope model in your tags:

<form ng-controller="Sarapastrule" name="form">
</form>

Check in : http://jsfiddle.net/NKyps/9/