我想運行一個小例子,但它不起作用。 的HTML。角度ng-repeat不起作用
<body ng-app="angello">
<div ng-contoller="mainController">
<div class="span4 sidebar-content">
<h2> stories </h2>
<div ng-repeat="story in stories">
<h4> {{ story.title }} </h4>
<p> {{ story.description }} </p>
</div>
</div>
</div>
腳本代碼:
angular.module('angello',[])
.controller('mainController', function($scope) {
$scope.stories = [
{title:'Story 00', description:'Description pending.'},
{title:'Story 01', description:'Description pending.'},
{title:'Story 02', description:'Description pending.'},
{title:'Story 03', description:'Description pending.'},
{title:'Story 04', description:'Description pending.'},
{title:'Story 05', description:'Description pending.'}];
});
預期的是,故事中列出但只有 {{story.title}} {{} story.description } 標籤。問題是什麼?爲什麼這些故事沒有列出?
小提琴: http://jsfiddle.net/tire0011/gU7Qx/
在「框架和擴展」部分中,選擇了「onLoad」。這太遲了,因爲角度已經運行了。 – zeroflagL