Thursday, 8 October 2020

AJS1

 

<html>

 <head>

<script src="angular.min.js"></script>

 <script>

var app = angular.module("myApp", []);

app.controller('userCtrl', ['$scope', function ($scope) {

$scope.showGames = function () {

$scope.games = [

{ GameName: 'Cricket-', PlayerName: 'sachin', GameType: 'outdoor' },

{ GameName: 'Chess-', PlayerName: 'Anand', GameType: 'Indoor' },

{ GameName: 'Tennis-', PlayerName: 'Serena', GameType: 'outdoor' }];

}

}]);

           

</script>

</head>

<body ng-app="myApp" ng-controller="userCtrl">

<form>

<div ng-app="myApp" ng-init="ga='Games array Elements!'">

 

<p ng-bind="ga"></p>

</div>

<div ng-controller="userCtrl">

<div ng-repeat='game in games'>

{{game.GameName}}

{{game.PlayerName}}

{{game.GameType}}

</div>

</div>

<input type="button" ng-click="showGames()" value="Click Here"> </button>

</form>

 </body>

</html>