10

HTML

<input type="text" ng-model="email" ng-disabled="button" rquired>
<a class="btn" ng-model="button">edit</a>

So basically I want to enable the input field when the button is clicked. I could do this with some javascript but I want to figure out an easy way for this.

The above example does not work. Any ideas why?

1 Answer 1

17

You can use ng-click to change the value of button:

<input type="text" ng-model="email" ng-disabled="button" required ng-init="button=true">
<a class="btn" ng-click="button=false">enable edit</a>
<a class="btn" ng-click="button=true">disable edit</a>
<a class="btn" ng-click="button=!button">toggle edit</a>
Sign up to request clarification or add additional context in comments.

1 Comment

Greate, is there any chance to have the input initally disabled?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.