user2701050
user2701050

Reputation: 1

The following code doesn't perform as expected. The list does not render

The following code displays only the input box when run in the browser (Chrome). It seems to have broken when I attempted using the ng-controller directive.

     <!doctype html>
     <html ng-app="">
     <head>
         <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.6/angular.min.js">  </script>
     <script>
        function SController($Scope) {
       $Scope.customers =
                 [{name:'John Smith',city:'Kingston'},
        {name:'Jane Doe',city:'Ocho Rios'},
        {name:'Brian Wade',city:'Negril'},
        {name:'John Barker',city:'Mandeville'} ];
        }
    </script>
      </head>
      <body ng-controller="SController">
        <div class="container">
          <input type="text" data-ng-model="name"/>  
      <ul>
        <li ng-repeat="person in customers | filter:name | orderBy:'city'">{{ person.name}} - {{ person.city }} </li>
      </ul>
        </div>
      </body>
    </html>

Upvotes: 0

Views: 26

Answers (1)

Well, at first sight, it seems that you're using $Scope instead of the correct $scope. Replace those occurrences and try again.

Upvotes: 1

Related Questions