Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html ng-app="studentApp">
<head>
  <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.14/angular.min.js">
  </script>
  <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.14/angular-route.min.js">
  </script>
  <meta charset="utf-8">
  <title>AngularJS Provider Example</title>
</head>
<body ng-controller="ItemController">
  <input type="text" ng-model="searchString" 
         placeholder="Enter search item">
  <ol>
      <li ng-repeat="fruit in fruits | filter:searchString">
        {{fruit}}
      </li>
  </ol>
  
  <input type="text" ng-model="subject" 
         placeholder="Enter search subject">
  <ol>
      <li ng-repeat="student in students | filter:subject">
        {{student.name}} -- {{student.subject}}
      </li>
  </ol>
  
  <input type="text" ng-model="name" 
         placeholder="Enter search name">
  <ol>
      <li ng-repeat="student in students | filter:name">
        {{student.name}} -- {{student.subject}}
      </li>
  </ol>
  
</body>
</html>
 
var studentApp = angular.module("studentApp",[]);
//Using a provider inside  controller
studentApp.controller("ItemController",
  function ($scope) {
  $scope.fruits = [
          "Apple","Grapes","Orange", 
          "Banana","Pears","Plum",
          "Mango","kiwi","litchi"
      ];
  $scope.students = [
    {"name":"Sandeep","subject":"English"},
    {"name":"John","subject":"Mathematics"},
    {"name":"Roja","subject":"Computer"},
    {"name":"Balaji","subject":"English"},
    {"name":"Suresh","subject":"Computer"},
    {"name":"Bharat","subject":"English"},
    {"name":"Arun","subject":"geography"},
  ];
});
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
saan1984pro
0viewers