我創建了一個控制器(movies.js)爲如下─NG重複不會對角JS
'use strict';
angular.module('clientApp')
.controller('MoviesCtrl', function ($scope) {
$scope.movies = [
{
title:'Star Wars!',
url:'http://www.google.com'
},
{
title: 'Star Wars2!',
url: 'http://www.google.com'
},
{
title: 'Star Wars3!',
url: 'http://www.google.com'
}
];
});
現在我想要在電影中使用NG-重複訪問每個對象的值工作.html-
<table class="table table-striped">
<thead>
<th>Title</th>
<th>URL</th>
</thead>
<tbody>
<tr ng-repeat="movie in movies">
<td> {{ movie.title }} </td>
<td> {{ movie.url }} </td>
</tr>
</tbody>
</table>
但是,這些值未按預期填充。有人可以提供任何提示,我應該在哪裏尋找解決辦法?
'$ scope.movies',而不是'this.movies' – atinder
試過了,但是不起作用 –
你指定'NG-控制器'和'NG-app'在你的HTML標記? – user2718281