SYBBA(CA)
Angular Js Practical Slips
Slip no.1
Write an AngularJS script to
display list of games stored in an array on click of button using ng-click. And
also Demonstrate ng-init, ng-bind
directive of AngularJS.
<!DOCTYPE html>
<html>
<head>
<script src="C:\angular-1.8.0\angular-1.8.0\angular.js"></script>
</head>
<body ng-app="myApp">
<div ng-controller="myCtrl" >
<button ng-click="myFunc()">Display Games</button>
<ol>
<li ng-repeat="i in game" ng-bind="i"></li>
<ol>
</div>
<script>
angular.module('myApp', [])
.controller('myCtrl', ['$scope', function($scope) {
$scope.count = 0;
$scope.myFunc = function() {
$scope.game=['Cricket','vollyball','Basketball'];
};
}]);
</script>
</body>
</html>
No comments:
Post a Comment