javascript - 为什么我的列表不会出现使用 ionic?

标签 javascript html css angularjs ionic-framework

每次我尝试使用 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/

相关文章:

javascript - 将元素 append 到数组的单个元素

javascript - 组织 JavaScript 代码以使其在 Eclipse Outline 中可见

php - 在许多页面上包含一个相同的 html

javascript - 如何写一个不死边界的变量

javascript - OnSubmit 函数不会更新 React 中的 React hook 状态变量

html - Fullpage.js 背景图片

javascript - 网络音频 Api 输出

javascript - 如何使此联系​​表起作用?

css - 为什么 Bootstrap 4 在移动设备上不会中断?

javascript - 如何从登录页面创建登录代码到索引?