2013-08-20 58 views
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> 
+1

使用'$ scope'而不是'$ Scope'。 –

回答

1

嗯,乍一看,似乎你正在使用$Scope而不是正確的$scope。替換這些事件並重試。