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>
1
  • where have you defined the module? Commented Sep 27, 2015 at 10:32

1 Answer 1

0

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

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.