-
Notifications
You must be signed in to change notification settings - Fork 0
/
Example-ng-switch.html
36 lines (35 loc) · 1.31 KB
/
Example-ng-switch.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<!DOCTYPE html>
<html>
<head>
<title>Switch Case using AngularJS?</title>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.3.8/angular.min.js"></script>
<script type="text/javascript">
(function(angular) {
angular.module('CondMod', [])
.controller('CondCtrl', ['$scope', function($scope) {
$scope.ddlOptions = ['Blog', 'Business', 'Fashion', 'Career', 'Education', 'Others'];
$scope.selection = $scope.ddlOptions[0];
}]);
})(window.angular);
</script>
</head>
<body ng-app="CondMod">
<div style="float:left;"><h2>Example of using Switch Case in AngularJS</h2></div>
<div style="float:right;"><img src="../images/infosys.gif" alt="Infosys" title="Infosys" style="width:420px;" /></div>
<div style="clear:both;"></div>
<hr />
<div ng-controller="CondCtrl">
<select ng-model="selection" ng-options="item for item in ddlOptions">
</select>
<br /><br />
<div ng-switch on="selection">
<div ng-switch-when="Blog">Blog save Time.</div>
<div ng-switch-when="Business">Business is made for Busy People.</div>
<div ng-switch-when="Fashion">Fashion updates Regularly.</div>
<div ng-switch-when="Career">Career is Like a Ladder.</div>
<div ng-switch-when="Education">Education is must Required.</div>
<div ng-switch-default>This is the Default value for Switch Case.</div>
</div>
</div>
</body>
</html>