Click to Edit with AngularJS
Example 1
HTML
<section ng-app="myApp" ng-controller="mainCtrl">
<input type="{{inputType}}" placeholder="Put your password" />
<input type="checkbox" id="checkbox" ng-model="pass_cb" ng-click="togglePassword()" />
<label for="checkbox" ng-if="pass_cb === true">Hide password</label>
<label for="checkbox" ng-if="pass_cb === false">Show password</label>
</section>
<script src="http://code.angularjs.org/1.2.13/angular.min.js"></script>
JavaScript
var myApp = angular.module('myApp', []);
myApp.controller('mainCtrl', ['$scope', function( $scope ){
$scope.pass_cb = false;
$scope.inputType = 'password';
$scope.togglePassword = function(){
if ($scope.inputType == 'password')
$scope.inputType = 'text';
else
$scope.inputType = 'password';
};
}]);