How to show and hide the values using select in angularjs

Tsurendra690-29180
Posted by Tsurendra690-29180 under AngularJS category on | Points: 40 | Views : 460
Here we are going to see how to show and hide the values.
<!DOCTYPE html>
<html>
<head>
<title>Dropdown</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
</head>
<body ng-app="">
<p style="font-size:20px;color:blue;">Hide and Display using Angularjs</p>
Show HTML:
<select ng-model="myVar">
<option value="1">Display</option>
<option value="2">Hide</option>
</select>
<div ng-class="col-xs-2" ng-show="myVar==1">
<form class="form-horizontal">
<div class="form-group">
<label for="inputFirstName" class="control-label col-xs-2">FirstName</label>
<div class="col-xs-10">
<input type="text" class="form-control" id="inputFirstName" placeholder="First Name">
</div>
</div>
<div class="form-group">
<label for="inputLastName" class="control-label col-xs-2">LastName</label>
<div class="col-xs-10">
<input type="text" class="form-control" id="inputLastName" placeholder="Last Name">
</div>
</div>
<div class="form-group">
<label for="inputEmail" class="control-label col-xs-2">Email</label>
<div class="col-xs-10">
<input type="email" class="form-control" id="inputEmail" placeholder="Email">
</div>
</div>
<div class="form-group">
<label for="inputPassword" class="control-label col-xs-2">Password</label>
<div class="col-xs-10">
<input type="password" class="form-control" id="inputPassword" placeholder="Password">
</div>
</div>
<div class="form-group">
<div class="col-xs-offset-2 col-xs-10">
<button type="submit" class="btn btn-primary">Sign Up</button>
</div>
</div>
</form>
</div>

</body>
</html>

Comments or Responses

Login to post response