1

In the following if checkbox is clicked the readonly attribute from the textbox must be removed and on unclicking git should be added.Can this be done by angular directive

<div class="radio"> <label> <input type="radio">Project</label> <input type="text" name="project" id="project" readonly/> </div> 
1

2 Answers 2

2

You can just use the built-in directive ngReadonly:

<input type="checkbox" ng-model="readonly">Project</label> <input type="text" name="project" id="project" value="" placeholder="Project" ng-readonly="!readonly"/> 

Here's a working plunkr.

2
1

Take a look on https://docs.angularjs.org/api/ng/directive/ngReadonly:

<label>Check me to make text readonly: <input type="checkbox" ng-model="checked"></label><br/> <input type="text" ng-readonly="checked" value="I'm Angular" aria-label="Readonly field" /> 

    Start asking to get answers

    Find the answer to your question by asking.

    Ask question

    Explore related questions

    See similar questions with these tags.