var app = angular.module('plunker', ['ui.bootstrap']);
app.controller('MainCtrl', function($scope) {
$scope.params = {};
$scope.showPassword = false;
$scope.toggleShowPassword = function() {
$scope.showPassword = !$scope.showPassword;
}
});
<!DOCTYPE html>
<html ng-app="plunker">
<head>
<meta charset="utf-8" />
<title>AngularJS Plunker</title>
<script>document.write('<base href="' + document.location + '" />');</script>
<link rel="stylesheet" href="style.css" />
<script data-require="angular.js@1.4.x" src="https://code.angularjs.org/1.4.9/angular.js" data-semver="1.4.9"></script>
<script src="//angular-ui.github.io/bootstrap/ui-bootstrap-tpls-1.3.3.js"></script>
<link href="//netdna.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet">
<script src="app.js"></script>
</head>
<body ng-controller="MainCtrl">
<div style="margin: 20px; max-width: 500px;">
<!-- show password as type="password" -->
<div ng-if="!showPassword"
class="form-group has-feedback">
<label>password</label>
<input type="password"
ng-model="params.password"
class="form-control"
placeholder="type something here...">
<span ng-if="params.password"
ng-click="toggleShowPassword()"
class="glyphicon glyphicon-eye-open form-control-feedback"
style="cursor: pointer; pointer-events: all;">
</span>
</div>
<!-- show password as type="text" -->
<div ng-if="showPassword"
class="form-group has-feedback">
<label>password</label>
<input type="text"
ng-model="params.password"
class="form-control"
placeholder="type something here...">
<span ng-if="params.password"
ng-click="toggleShowPassword()"
class="glyphicon glyphicon-eye-close form-control-feedback"
style="cursor: pointer; pointer-events: all;">
</span>
</div>
</div>
</body>
</html>
/* Put your css in here */