AngularJS LocalStorageModule不可用

时间:2014-09-11 21:17:10

标签: angularjs ionic-framework

我试图让一个全新的离子项目使用角度局部存储而没有运气。我错误地引用了角度局部存储,但我不知道如何。

https://github.com/grevory/angular-local-storage

ionic start myApp tabs
cd myApp
ionic platform add ios
ionic build ios
bower install angular-local-storage

// app.js
angular.module('starter', ['ionic', 'starter.controllers', 'starter.services', 'LocalStorageModule'])

然后

ionic serve

错误

Uncaught Error: [$injector:modulerr] Failed to instantiate module starter due to:
Error: [$injector:modulerr] Failed to instantiate module LocalStorageModule due to:
Error: [$injector:nomod] Module 'LocalStorageModule' 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.

我错过了什么简单的事情?

2 个答案:

答案 0 :(得分:2)

我对离子并不熟悉,但在我看来你错过了这个剧本。

您确定页面上包含该脚本吗?我确认bower确实安装了你认为它应该是的脚本,然后确保在抛出此错误之前实际引用它。

答案 1 :(得分:0)

盖伊应该检查是否已添加指向其脚本的链接

src =“https://rawgit.com/grevory/angular-local-storage/master/dist/angular-local-storage.min.js”

在索引文件中使用<script></script>标记。这可能是个问题。对于将来会看到这个的人。