Chance type input by check toggle

Hello friends!

I will like to change the type input “password” for “text” when the toggle button is checked.

How to do it?


I’ve tried but changing the input type on the fly doesn’t seem to work. An approach would be to have two input boxes. One with type password and one with type text, both with the same ng-model. Depending on the state of the toggle button you either show either one. Check out this CodePen for a demo.

You can do :
<input type ={{isToggled?'password':'text'}}></input> <ion-toggle ng-model="isToggled" >toggle</ion-toggle>

I’d say i’ts the fastest way to do so

Thanks guy! U helped me!

I’ve tried this before I posted the other solution, but on the CodePen changing the input type while the form was already displayed didn’t do anything.