0

以下代码在浏览器(Chrome)中运行时仅显示输入框。当我尝试使用 ng-controller 指令时,它似乎已经坏了。

     <!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>
4

1 回答 1

1

好吧,乍一看,您似乎在使用$Scope而不是正确的$scope. 替换这些事件并重试。

于 2013-08-20T22:21:06.330 回答