AngularJS 앱 시드를 사용하려고하는데 이상한 결과가 나타납니다. view2.html에서AngularJS의 컨트롤러
나는이 :
<div ng-controller="view_ctrl_2">
<div id="view2">
<table class="table table-striped">
<thead>
<tr>
<td>col1</td> <td>col2</td> <td>col3</td> <td>col4</td>
</tr>
</thead>
<tr ng-repeat="entry in entries">
<td>{{entry.col1}}</td> <td>{{entry.col2}}</td> <td>{{entry.col3}}</td> <td>{{entry.col4}}</td>
</tr>
</table>
</div>
</div>
내 controllers.js에
내가 그러나angular.module('myApp.controllers', [])
.controller('view_ctrl_2', [function() {
var entries = [
{ "col1":"val01", "col2":"val02", "col3":"val03", "col4":"val04" },
{ "col1":"val05", "col2":"val06", "col3":"val07", "col4":"val08" },
{ "col1":"val09", "col2":"val10", "col3":"val11", "col4":"val12" }
];
}]);
이 파일을, 나는 페이지의 출력을받지 못했습니다. 그것은 테이블을 보여 주지만, ng-repeat는 그것에 테이블을 놓지 않습니다. 내 생각 엔 $ scope 변수와 관련이 없다는 것입니까?
대신 $ scope.entries가 필요합니다. $ 범위 변수 만 컨트롤러 외부에서 볼 수 있습니다. –