离子 + 火基,错误模块“火基”不可用
Ionic + firebase, error Module 'firebase' is not available
我正在使用最新的Ionic,我想为我的应用实现一个Firebase后端。我按照离子入门指南进行操作,然后使用凉亭安装安装火基和角火。
生成的错误是:
Uncaught Error: [$injector:modulerr] Failed to instantiate module starter due to:
Error: [$injector:modulerr] Failed to instantiate module starter.controllers due to:
Error: [$injector:modulerr] Failed to instantiate module firebase due to:
Error: [$injector:nomod] Module 'firebase' 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.
因此.html将 firebase 链接添加到索引中至少对我来说并不能解决这个问题。使用bower安装Firebase,只需将"firebase"传递到控制器中即可自动捆绑.js但是它会产生此错误。有什么想法吗?提前感谢!
到目前为止,这是我在应用程序中所做的全部更改:
索引.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
<title></title>
<link href="lib/ionic/css/ionic.css" rel="stylesheet">
<link href="css/style.css" rel="stylesheet">
<!-- IF using Sass (run gulp sass first), then uncomment below and remove the CSS includes above
<link href="css/ionic.app.css" rel="stylesheet">
-->
<!-- ionic/angularjs js -->
<script src="lib/ionic/js/ionic.bundle.js"></script>
<!-- cordova script (this will be a 404 during development) -->
<script src="cordova.js"></script>
<!-- your app's js -->
<script src="js/app.js"></script>
<script src="js/controllers.js"></script>
<script src="js/services.js"></script>
</head>
<body ng-app="starter" animation="slide-left-right-ios7">
<!--
The nav bar that will be updated as we navigate between views.
-->
<ion-nav-bar class="bar-stable nav-title-slide-ios7">
<ion-nav-back-button class="button-icon icon ion-ios7-arrow-back">
Back
</ion-nav-back-button>
</ion-nav-bar>
<!--
The views will be rendered in the <ion-nav-view> directive below
Templates are in the /templates folder (but you could also
have templates inline in this html file if you'd like).
-->
<ion-nav-view></ion-nav-view>
</body>
</html>
应用.js
angular.module('starter', ['ionic', 'starter.controllers', 'starter.services'])
.run(function($ionicPlatform) {
$ionicPlatform.ready(function() {
// Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
// for form inputs)
if(window.cordova && window.cordova.plugins.Keyboard) {
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
}
if(window.StatusBar) {
// org.apache.cordova.statusbar required
StatusBar.styleDefault();
}
});
})
控制器.js
angular.module('starter.controllers', ['firebase'])
.controller('DashCtrl', function ($scope, $firebase) {
// TV Shows Table
var moviesRef = new Firebase("https://moviehunt.firebaseio.com/");
var sync = $firebase(moviesRef);
$scope.movies = sync.$asArray();
})
好的,这是我的解决方案,我完全从头开始,而是使用侧边菜单创建了 ionic 应用程序:
离子启动我的应用程序侧边菜单
然后使用鲍尔和鲍尔安装火力基地安装角度火
然后将以下 HTML 链接添加到索引.html:
<script src="lib/firebase/firebase.js"></script>
<script src="lib/firebase-simple-login/firebase-simple-login.js"></script>
<script src="lib/angularfire/dist/angularfire.js"></script>
相关文章:
- ES6构造函数返回基类的实例
- Javascript,访问一个主要对象模块模式中的每个对象
- 节点Js:How to catch a“;没有这样的文件或目录“;读取线模块出错
- 如何从模块链中调用函数.导出到节点中
- 尽管链接成功并已成功下载,但未找到NPM模块
- 节点是否需要模块传递带有方括号的arg?这是个错误吗
- 从模块内部访问Express装载路径
- RequireJS向模块传递配置总是返回undefined
- 可变大小的JavaScript字符串如何成为基元类型
- Node.js正在更改应用程序以使用集群模块
- 在Meteor项目中安装并包含npm模块后出错
- 模块模式和这个
- 将依赖外部库的UMD模块与browserfy捆绑在一起
- 找不到模块捆绑包
- JavaScript命名约定;静态“;类或模块
- 显示模块模式在Knockout中设置模型的新实例
- 存储带有角度和火基的日期
- 离子 + 火基,错误模块“火基”不可用
- 在angularjs中,如何从基模块中设置一个服务,以调用使用基模块的模块中服务上的函数
- 我想如何从火基对象获取数据