0

I have 2 fields one is password and another is checkbox

...
...
<input type="password" ng-model="data.password" id="form_password"></input>
<input type="checkbox" ng-model="data.show_password" id="show_password"></input>
<label> Show Password</label>
...
...

When user click on show_password checkbox, I want to change form_password type to text so user can see the password.

1 Answer 1

4

I would do the following:

<input ng-show="!data.show_password" type="password" ng-model="data.password" id="form_password">
<input ng-show="data.show_password" type="text" ng-model="data.password">
<input type="checkbox" ng-model="data.show_password" id="show_password">
<label>Show Password</label>

(or obviously you could use ng-hide, stylistic preference)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.