我正在关注其todo app上的基本离子教程:
<body ng-app="todo" ng-controller="TodoCtrl">
<!-- Center content -->
<ion-side-menu-content>
<ion-header-bar class="bar-dark">
<h1 class="title">Todo</h1>
</ion-header-bar>
<ion-content>
<!-- our list and list items -->
<ion-list>
<ion-item ng-repeat="task in tasks">
{{task.title}}
</ion-item>
</ion-list>
</ion-content>
</ion-side-menu-content>
</body>
在app.js
angular.module('todo', ['ionic'])
.controller('TodoCtrl', function($scope) {
$scope.tasks = [
{ title: 'Collect coins' },
{ title: 'Eat mushrooms' },
{ title: 'Get high enough to grab the flag' },
{ title: 'Find the Princess' }
];
})
它只显示顶部导航栏,但没有任何任务,但有趣的评论:
<ion-list><div class="list">
<!-- ngRepeat: task in tasks -->
</div></ion-list>
但如果我将一个空数组作为模块的第二个参数传递,那么它就可以正常工作。
我在这里缺少什么?
答案 0 :(得分:0)
我从html中删除了<ion-side-menu-content>
,一切似乎都很好:
<body ng-app="starter" ng-controller="TodoCtrl">
<ion-header-bar class="bar-dark">
<h1 class="title">Todo</h1>
</ion-header-bar>
<ion-content>
<!-- our list and list items -->
<ion-list>
<ion-item ng-repeat="task in tasks">
{{task.title}}
</ion-item>
</ion-list>
</ion-content>
</body>