0

I want to filter results from an array but i'm getting an error "SimpleController is not a function, got undefined"

<div class="container" ng-controller="SimpleController">
    <input type="text" ng-model="name">
    <ul>
        <li ng-repeat="PersonNames in names | filter:name | orderBy:name">{{ PersonNames.name }} - {{PersonNames.city}}</li>
    </ul>
</div>

JS

  <script>
   function SimpleController($scope){
    $scope.names =[
        {name:'Danial Pervaiz' , city:'Denver'},
        {name:'David Johnson' , city:'Jamaica'},
        {name:'David Hopsin' , city:'Australia'}
    ];
   }
 </script>
Daniel
  • 1,438
  • 6
  • 20
  • 37

1 Answers1

0

You have not defined module or mentioned ng-app anywhere.Here is the working Jsfiddle

Sajeetharan
  • 216,225
  • 63
  • 350
  • 396