Friday, August 26, 2016

Controller in Angular JS

<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
<script>
angular.module('test', []).controller('menu', function($scope) {
    $scope.names = [
        {furit:'Orange',vegtable:'Drumstick'},
        {furit:'Apple',vegtable:'Ladyfinger'},
        {furit:'Grape',vegtable:'Bringal'}
    ];
});
</script>


<div ng-app="test" ng-controller="menu">

<ul>
  <li ng-repeat="x in names">
{{x.furit }}
  </li>
</ul>
<ul>
  <ol ng-repeat="x in names">
{{x.vegtable}}
  </ol>
</ul>
</div>

No comments:

Post a Comment