每次我尝试使用 ionic serve 显示我的列表时,我只会得到一个空白屏幕?我已经一步步按照教程进行操作,但还是一无所获?
我的列表 html 代码:
<body ng-app="calorific" ng-controller="calCtrl">
<ion-pane>
<ion-header-bar class="bar bar-header bar-assertive">
<h1 class="title">Calorific</h1>
</ion-header-bar>
<ion-content>
<ion-list>
<ion-item ng-repeat="todos in todo"{{todo.name}} </ion-item>
</ion-list>
</ion-content>
</ion-pane>
我的JS:
app.controller('calCtrl', function($scope){
$scope.todo = [
{name: 'apple'},
{name: 'banana'},
{name: 'pear'},
{name: 'kiwi'},
{name: 'kfc'}
]
})
GET http://localhost:8100/css/style.css
app.js:17 Uncaught ReferenceError: app is not defined
ionic.bundle.js:19526 Error: [ng:areq] Argument 'calCtrl' is not a function, got undefined
http://errors.angularjs.org/1.3.13/ng/areq?p0=calCtrl&p1=not%20a%20function%2C%20got%20undefined
at REGEX_STRING_REGEXP (ionic.bundle.js:7982)
at assertArg (ionic.bundle.js:9499)
at assertArgFn (ionic.bundle.js:9509)
at ionic.bundle.js:16350
at ionic.bundle.js:15518
at forEach (ionic.bundle.js:8250)
at nodeLinkFn (ionic.bundle.js:15505)
at compositeLinkFn (ionic.bundle.js:14997)
at publicLinkFn (ionic.bundle.js:14876)
at ionic.bundle.js:9369ionic.bundle.js:19526 (anonymous function)ionic.bundle.js:16476 $getionic.bundle.js:22421 $get.Scope.$applyionic.bundle.js:9367 bootstrapApplyionic.bundle.js:12104 invokeionic.bundle.js:9365 doBootstrapionic.bundle.js:9385 bootstrapionic.bundle.js:9279 angularInitionic.bundle.js:34044 (anonymous function)ionic.bundle.js:10663 triggerionic.bundle.js:10933 eventHandler
最佳答案
我认为您的 html 中有错字。不应该是todos吗,
<ion-item ng-repeat="todos in todo">{{todos.name}} </ion-item>
我还为 ion-item 添加了一个缺少的结束标记。我对 Ionic 不太熟悉,所以我只是想指出这一点。
关于javascript - 为什么我的列表不会出现使用 ionic?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29463049/