First, we have to download of angular js library and keep the link on our HTML page
After that create the ng-app and then create the controller and write below code
Now we have to design our HTML page for performing our functionality and copy and paste below code
</body>
Output:
After that create the ng-app and then create the controller and write below code
<head>
<meta name="viewport" content = "width=device-width" />
<title>Using AngularJs Directives and Data Binding < /title>
< script >
var app = angular.module("MyApp", []);
app.controller("SimpleController", function ($scope) {
$scope.customers = [
{ name: 'Mithilesh', city: 'Hyderabad' },
{ name: 'Mohan', city: 'Delhi' },
{ name: 'Ramesh', city: 'Bangluru' }
];
});
</script>
< /head>
Now we have to design our HTML page for performing our functionality and copy and paste below code
<body ng-app="MyApp">
<div ng-controller="SimpleController">
Name:
<br />
<input type="text" ng-model="name" />
<br />
<ul>
<li ng-repeat="cust in customers | filter:name">{{ cust.name }} - {{ cust.city }}</li>
</ul>
</div>
</body>
Output:
No comments:
Post a Comment