JavaScript - Hide Password Using AngularJS
Submitted by razormist on Saturday, January 26, 2019 - 21:04.
In this tutorial we will create a Hide Password Using AngularJS. AngularJS is a structural framework for dynamic web apps. It is a kind of template that extends HTML to a new level of coding techniques. It is mostly used by other well known site for creating a template.
There you have it we successfully created a Hide Password Using AngularJS. I hope that this very simple tutorial help you to what you are looking for. For more updates and tutorials just kindly visit this site. Enjoy Coding!!
Getting started:
First you will need to download & install the AngularJS here's the link https://angularjs.org/. And this is the link for the bootstrap that i used for the layout design https://getbootstrap.com/.The Main Interface
This code contains the interface of the application. This code will render application and display the form. To create this just write these block of code inside the text editor and save this as index.html.- <!DOCTYPE html>
- <html lang="en" ng-app="myModule">
- <head>
- <meta charset="UTF-8" name="viewport" content="width=device-width, initial-scale=1"/>
- <link rel="stylesheet" type="text/css" href="css/bootstrap.css"/>
- </head>
- <body ng-controller="myController">
- <nav class="navbar navbar-default">
- <div class="container-fluid">
- </div>
- </nav>
- <div class="col-md-6 well">
- <hr style="border-top:1px dotted #ccc;"/>
- <table class="table table-bordered">
- <thead class="alert-info">
- <tr>
- </tr>
- </thead>
- <tbody style="background-color:#fff;">
- <tr ng-repeat="user in users">
- </tr>
- </tbody>
- </table>
- </div>
- </body>
- </html>
Creating the Script
This code contains the script of the application. This code will hide the password when the button is clicked. To do this just copy write the code as shown below inside the text editor and save it as script.js.- var app = angular.module("myModule", [])
- .controller("myController", function($scope){
- var users = [
- {firstname: "Angelo", lastname: "Borg", age: "35", username: "borg123", password: "12345"},
- {firstname: "Jane", lastname: "watson", age: "16", username: "watson", password: "jane123"},
- {firstname: "Karl", lastname: "Heron", age: "21", username: "heron", password: "12345678"},
- ];
- $scope.users = users;
- $scope.content = undefined;
- $scope.contentToggle = function(name){
- if ($scope.isContentToggled(name)){
- $scope.content = undefined;
- } else {
- $scope.content = name;
- }
- }
- $scope.isContentToggled = function (name){
- return $scope.content == name;
- }
- });
Add new comment
- 39 views