离子+火力,错误模块'火力'不可用 [英] Ionic + firebase, error Module 'firebase' is not available

查看:155
本文介绍了离子+火力,错误模块'火力'不可用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是最新的离子和我要实现我的应用程序一个火力点后端。我跟着离子上手指南,然后用于凉亭install来安装火力点和角度射击。

产生的错误是:

 未捕获的错误:[$喷油器:modulerr]未能实例由于模块首发:
错误:[$喷油器:modulerr]未能实例由于模块starter.controllers:
错误:[$喷油器:modulerr]未能实例由于模块火力点:
错误:[$喷油器:NOMOD]模块'火力'不可!你要么拼写错误的模块名称,或忘了加载它。如果注册一个模块,确保指定的依赖关系作为第二个参数。

所以添加火力链接到的index.html至少对我来说并没有解决这个问题。使用凉亭安装火力它应该只是通过传递'火力'到controller.js自动捆绑,但它会产生这个错误。有任何想法吗?在先进的感谢!

这是所有我在应用迄今改变:

的index.html

 <!DOCTYPE HTML>
< HTML和GT;
  < HEAD>
    <间的charset =UTF-8>
    < META NAME =视CONTENT =初始规模= 1,最大规模= 1,用户可扩展性=无,宽度=设备宽度>
    <标题>< /标题>    <链接HREF =LIB /离子/ CSS / ionic.css的rel =stylesheet属性>
    <链接HREF =CSS / style.css文件的rel =stylesheet属性>    <! - 如果使用萨斯(运行一饮而尽SASS第一),然后在下面取消注释并取下上面的CSS包括
    <链接HREF =CSS / ionic.app.css的rel =stylesheet属性>
     - >    <! - 离子/ angularjs JS - >
    <脚本SRC =LIB /离子/ JS / ionic.bundle.js>< / SCRIPT>    <! - 科尔多瓦脚本(这将是开发过程中一个404) - GT;
    &所述; SCRIPT SRC =cordova.js>&下; /脚本>    <! - 您的应用程序的JS - >
    <脚本SRC =JS / app.js>< / SCRIPT>
    <脚本SRC =JS / controllers.js>< / SCRIPT>
    <脚本SRC =JS / services.js>< / SCRIPT>
  < /头>
  <机身NG-应用=启动器动画=滑动左 - 右 - ios7>
    <! -
      导航栏,因为我们之间意见的导航将被更新。
     - >
    <离子导航栏类=扎稳NAV-标题幻灯片ios7>
      <离子NAV-后退按钮类=按钮图标图标离子ios7箭头回>
        背部
      < /离子NAV-后退按钮>
    < /离子导航栏>
    <! -
      离子导航视图>该意见将在&lt呈现;下面指令
      模板是在/模板文件夹(但你也可以
      在这个HTML文件模板内联,如果你想)。
     - >
    <离子NAV-视图>< /离子NAV-视图>
  < /身体GT;
< / HTML>

app.js

  angular.module('启动',['离子','starter.controllers','starter.services']).RUN(函数($ ionicPlatform){
  $ ionicPlatform.ready(函数(){
    //默认隐藏附件栏(删除此显示键盘上方的附件栏
    //表单输入)
    如果(window.cordova&安培;&安培; window.cordova.plugins.Keyboard){
      cordova.plugins.Keyboard.hideKeyboardAccessoryBar(真);
    }
    如果(window.StatusBar){
      // org.apache.cordova.statusbar要求
      StatusBar.styleDefault();
    }
  });
})

controller.js

  angular.module('starter.controllers',['火力']).controller('DashCtrl',函数($范围,$火力点){  //电视节目表
  VAR moviesRef =新的火力地堡(https://moviehunt.firebaseio.com/);
  VAR同步= $火力(moviesRef);
  。$ scope.movi​​es = $同步asArray();})


解决方案

好吧,这里是我的解决方案,我是从零开始完全,而是创建了一个带有侧面菜单离子应用:

离子开始对myApp sidemenu

然后用凉亭和凉亭安装火力安装angularfire

,然后添加下面的HTML链接到index.html的:

 <脚本SRC =LIB /火力/ firebase.js>< / SCRIPT>
<脚本SRC =LIB /火力简单的登录/火力-简单login.js>< / SCRIPT>
<脚本SRC =LIB / angularfire /距离/ angularfire.js>< / SCRIPT>

I'm using the latest ionic and I want to implement a firebase backend for my app. I followed the ionic get started guide, then used bower install to install firebase and angular fire.

The error produced is:

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.

So adding the firebase links to the index.html does not fix this issue at least for me. Using bower to install firebase it should bundle automatically just by passing in 'firebase' into the controller.js, however it produces this error. Any ideas? Thanks in advanced!

This is all that I've changed in the app thus far:

Index.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>

app.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();
    }
  });
})

controller.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();

})

解决方案

Okay, here was my solution, I started from scratch completely, instead created the ionic app with a side menu:

ionic start myApp sidemenu

then used bower and bower install firebase install angularfire

and then added the following html links to the index.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>

这篇关于离子+火力,错误模块'火力'不可用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆