html - change type password style to none with angular -
i have doubt, i'd put in application check box, show or hide text of password's input
html
<input type="text" ng-model="data.username" placeholder="username" value="username" class="form-control" popover="inserisci qui il tuo username" popover-trigger="focus" popover-placement="right"/><br> <input id="pwd" type="password" ng-model="data.password" placeholder="password" value="password" class="form-control" popover="inserisci qua la tua password" popover-trigger="focus" popover-placement="right"/><br> <input class="btn-primary btn-lg" type="submit" value="login"> <button class="btn-warning btn-lg" type="button" ng-click="cancel()">cancella</button> <input ng-model="show" type="checkbox"><span>show password</span>
i need bind function on show, changes style of password field, or type. searching around find topics people discusses fact it's not possible change type, way imagine change style of field, there way change style of password 'none' style?
edit
if have used solution proposed alex, , have it' work, have tried use bind on type in way
html
<input id="pwd" type="{{passwordtype}}" ng-model="data.password" placeholder="password" value="password" class="form-control" popover="inserisci qua la tua password" popover-trigger="focus" popover-placement="right"/><br> <input ng-model='check' ng-change="show()" type="checkbox"><span>show password</span>
js
$scope.check=false $scope.show=function(){ if($scope.check==false){ $scope.check=true; $scope.passwordtype='text' }else{ $scope.check=false; $scope.passwordtype='password' } }
it works on explorer , on firefox, strangely on chrome , opera, when expect have text, field changes disc square, idea why?
you can use simple magic of show , hide.
example:
<input ng-show="show" type="text" ng-model="password"> <input ng-hide="show" type="password" ng-model="password"> <input type="checkbox" ng-model="show" ng-checked="false">
live example: http://jsfiddle.net/choroshin/694f7/1/
Comments
Post a Comment