【发布时间】:2014-12-10 20:25:33
【问题描述】:
我从 Ionic 和 Phonegap 开始。我在 html 正文中有两个类的列表元素
<body ng-app="todo">
<div class="list">
<a class="item item-icon-left" ng-click="derecha()" ng-controller="derecha"> Calama </a>
<a class="item item-icon-left" ng-click="abajo()" ng-controller="abajo"> Ollagüe </a>
</body>
在 app.js 中我得到了以下内容。
angular.module('todo', ['ionic'])
.controller('derecha', function($scope, $ionicModal) {
console.log("derecha");
});
.controller('abajo', function($scope, $ionicModal) {
console.log("abajo");
})
当我尝试在浏览器中查看时出现以下错误:
Error: [$injector:modulerr] Failed to instantiate module todo due to:
[$injector:nomod] Module 'todo' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.
http://errors.angularjs.org/1.2.25/$injector/nomod?p0=todo
我花了两天时间研究这个问题,但根本没有答案。有没有人可以帮助我使用列表的两个元素调用两个不同的函数?
提前致谢 --在
【问题讨论】:
-
你的js脚本文件包含了吗?