Enter Your Name :
Enter Your City:
<html ng-app> <head> <!--from infovision.com--> </head> <body> <div data-ng-controller="SimpleController"> Enter Your Name :<input type="text" data-ng-model="inputData.name"/> Enter Your City:<input type="text" data-ng-model="inputData.city"/> <button class="btn btn-primary" data-ng-click="addItem()">Add</button> <ul> <li data-ng-repeat="myItem in items">{{ myItem.name +" - "+ myItem.city}}</li> </ul> </div> <script> function SimpleController($scope) { $scope.items = [ { name: 'XML', city: 'W3C' }, { name: 'Java', city: 'Oracle' }, { name: 'CSS', city: 'W3c' }, { name: 'Tutorial', city: 'infovision.com' } ]; $scope.addItem = function () { $scope.items.push({ name: $scope.inputData.name, city: $scope.inputData.city }); }; } </script> </body> </html> |