tir*_*011 4 angularjs angularjs-ng-repeat
我想运行一个小例子,但它不起作用.HTML.
<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>
Run Code Online (Sandbox Code Playgroud)
脚本代码是:
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.'}];
});
Run Code Online (Sandbox Code Playgroud)
预计会列出故事,但只有{{story.title}} {{story.description}}标签.问题是什么?为什么这些故事没有列出?
在您的HTML中,您拼错了ng-controller.你错过了r.当然,也可以关闭body标签.
修理你之后ng-controller,以使的jsfiddle你的代码的工作,你也必须改变onLoad对Frameworks & Extensions以No-wrap - in <head>作为@zeroFlagL提及.
| 归档时间: |
|
| 查看次数: |
6488 次 |
| 最近记录: |