Kambe
Digital Currency Evangelist
2
MONTHS
2 2 MONTHS OF SERVICE
LEVEL 1
100 XP
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.
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.
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.
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!!
Download
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"
>
- <a
class
=
"navbar-brand"
href
=
"https://sourcecodester.com"
>
Sourcecodester</
a
>
- </
div
>
- </
nav>
- <div
class
=
"col-md-3"
></
div
>
- <div
class
=
"col-md-6 well"
>
- <h3
class
=
"text-primary"
>
JavaScript - Hide Password Using AngularJS</
h3
>
- <hr
style
=
"border-top:1px dotted #ccc;"
/
>
- <button
type
=
"button"
ng-click=
"contentToggle('password')"
class
=
"btn btn-primary"
>
Hide Password</
button
>
- <br
/
><br
/
>
- <table
class
=
"table table-bordered"
>
- <thead
class
=
"alert-info"
>
- <tr
>
- <th
>
Firstname</
th
>
- <th
>
Lastname</
th
>
- <th
>
Age</
th
>
- <th
>
Username</
th
>
- <th
ng-hide=
"isContentToggled('password')"
>
Password</
th
>
- <th
ng-show=
"isContentToggled('password')"
>
Password</
th
>
- </
tr
>
- </
thead
>
- <tbody
style
=
"background-color:#fff;"
>
- <tr
ng-repeat=
"user in users"
>
- <td
>
{{user.firstname}}</
td
>
- <td
>
{{user.lastname}}</
td
>
- <td
>
{{user.age}}</
td
>
- <td
>
{{user.username}}</
td
>
- <td
ng-hide=
"isContentToggled('password')"
>
{{user.password}}</
td
>
- <td
ng-show=
"isContentToggled('password')"
>
*****</
td
>
- </
tr
>
- </
tbody
>
- </
table
>
- </
div
>
- <script
src
=
"js/angular.js"
></
script
>
- <script
src
=
"js/script.js"
></
script
>
- </
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;
- }
- }
)
;
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!!
Download
You must upgrade your account or reply in the thread to view the hidden content.