opitzconsulting / jquery-mobile-angular-adapter

jquery mobile angular adapter
MIT License
517 stars 114 forks source link

Input type="{{}}" not working correctly #186

Closed pascalwhoop closed 11 years ago

pascalwhoop commented 11 years ago

Hey there. i wanted to implement a "show password" switch for my login. Sadly if i use the angular {{var}} within an input type="{{ }}" the css is broken and the input field is not looking good anymore.

Here is a fiddle: http://jsfiddle.net/ZHKBA/144/

thx for your work!

tbosch commented 11 years ago

Hi, sorry, but the type attribute of a <input> defines what kind of validations are performed, so it is not possible to do databinding for it. I also doubt it is possible in plain angular, without jquery mobile.

However, you can use ngm-if or ng-switch, like this: http://jsfiddle.net/ZHKBA/145/

Tobias

pascalwhoop commented 11 years ago

thx i used the ng-switch variant and it works fine. However i didnt like to have 2 input fields with the same value but rather i wrote a function that is invoked once the checkbox is clicked which gets the input element and changes the type programmatically. Works fine as well :) thx for the explanation!