javascript - Using Ionic - Cannot get Firebase to load properly - Error: Module 'firebase' is not available -


i have looked @ following questions , have not been able find effective solution, hence posting question.

ionic + firebase, error module 'firebase' not available

firebase, angularfire error: module firebase not available

angularfire 'firebase' not defined

i beginner , first ionic app using firebase. trying firebase load properly. have included following cdns in index.html:

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), uncomment below , remove css includes above     <link href="css/ionic.app.css" rel="stylesheet">     -->  <!--firebase-->      <script src="https://cdn.firebase.com/js/client/2.2.1/firebase.js"></script> <!--angularfire-->      <script src="https://cdn.firebase.com/libs/angularfire/1.0.0/angularfire.min.js"></script>      <!-- ionic/angularjs js -->     <script src="lib/ionic/js/ionic.bundle.js"></script>      <!-- cordova script (this 404 during development) -->     <script src="cordova.js"></script>      <!-- 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">     <!--       nav bar updated navigate between views.     -->     <ion-nav-bar class="bar-stable">       <ion-nav-back-button>       </ion-nav-back-button>     </ion-nav-bar>     <!--       views rendered in <ion-nav-view> directive below       templates in /templates folder (but       have templates inline in html file if you'd like).     -->     <ion-nav-view></ion-nav-view>   </body> </html> 

app.js:

angular.module('starter', ['ionic', 'firebase', 'starter.controllers', 'starter.services'])    .run(function($ionicplatform) {   $ionicplatform.ready(function() {     // hide accessory bar default (remove show accessory bar above keyboard     // form inputs)     if (window.cordova && window.cordova.plugins && window.cordova.plugins.keyboard) {       cordova.plugins.keyboard.hidekeyboardaccessorybar(true);     }     if (window.statusbar) {       // org.apache.cordova.statusbar required       statusbar.stylelightcontent();     }     }); })  .config(function($stateprovider, $urlrouterprovider) {    // ionic uses angularui router uses concept of states   // learn more here: https://github.com/angular-ui/ui-router   // set various states app can in.   // each state's controller can found in controllers.js   $stateprovider    // setup abstract state tabs directive     .state('tab', {     url: "/tab",     abstract: true,     templateurl: "templates/tabs.html"   })    // each tab has own nav history stack:    .state('tab.login', {     url: '/login',     views: {       'tab-login': {         templateurl: 'templates/tab-login.html',         controller: 'loginctrl'       }     }   })    .state('tab.new', {     url: '/new',     views: {       'tab-new': {         templateurl: 'templates/tab-new.html',         controller: 'newctrl'       }     }   })    .state('tab.home', {       url: '/home',       views: {         'tab-home': {           templateurl: 'templates/tab-home.html',           controller: 'homectrl'         }       }     })     .state('tab.profile', {     url: '/profile',     views: {       'tab-profile': {         templateurl: 'templates/tab-profile.html',         controller: 'profilectrl'       }     }   });    // if none of above states matched, use fallback   $urlrouterprovider.otherwise('/tab/home');  }); 

controller.js:

angular.module('starter.controllers', ['ionic', 'firebase', 'starter.services'])   .controller('loginctrl', function($scope) {   })  .controller('newctrl', function($scope) {})  .controller('homectrl', function($scope, chats) {   $scope.chats = chats.all();   $scope.remove = function(chat) {     chats.remove(chat);   } })    .controller('profilectrl', function($scope) {   $scope.settings = {     enablefriends: true   }; }); 

with code, errors:

uncaught referenceerror: angular not defined(anonymous function) @ angularfire.min.js:12(anonymous function) @ angularfire.min.js:12 ionic.bundle.js:8762 uncaught error: [$injector:modulerr] failed instantiate module starter due to: error: [$injector:modulerr] failed instantiate module firebase due to: error: [$injector:nomod] module 'firebase' not available! either misspelled module name or forgot load it. if registering module ensure specify dependencies second argument. http://errors.angularjs.org/1.3.13/$injector/nomod?p0=firebase     @ regex_string_regexp (http://localhost:8100/lib/ionic/js/ionic.bundle.js:8762:12)     @ http://localhost:8100/lib/ionic/js/ionic.bundle.js:10466:17     @ ensure (http://localhost:8100/lib/ionic/js/ionic.bundle.js:10390:38)     @ module (http://localhost:8100/lib/ionic/js/ionic.bundle.js:10464:14)     @ http://localhost:8100/lib/ionic/js/ionic.bundle.js:12796:22     @ foreach (http://localhost:8100/lib/ionic/js/ionic.bundle.js:9022:20)     @ loadmodules (http://localhost:8100/lib/ionic/js/ionic.bundle.js:12780:5)     @ http://localhost:8100/lib/ionic/js/ionic.bundle.js:12797:40     @ foreach (http://localhost:8100/lib/ionic/js/ionic.bundle.js:9022:20)     @ loadmodules (http://localhost:8100/lib/ionic/js/ionic.bundle.js:12780:5) http://errors.angularjs.org/1.3.13/$injector/modulerr?p0=firebase&p1=error%…%3a%2f%2flocalhost%3a8100%2flib%2fionic%2fjs%2fionic.bundle.js%3a12780%3a5)     @ regex_string_regexp (http://localhost:8100/lib/ionic/js/ionic.bundle.js:8762:12)     @ http://localhost:8100/lib/ionic/js/ionic.bundle.js:12819:15     @ foreach (http://localhost:8100/lib/ionic/js/ionic.bundle.js:9022:20)     @ loadmodules (http://localhost:8100/lib/ionic/js/ionic.bundle.js:12780:5)     @ http://localhost:8100/lib/ionic/js/ionic.bundle.js:12797:40     @ foreach (http://localhost:8100/lib/ionic/js/ionic.bundle.js:9022:20)     @ loadmodules (http://localhost:8100/lib/ionic/js/ionic.bundle.js:12780:5)     @ createinjector (http://localhost:8100/lib/ionic/js/ionic.bundle.js:12706:11)     @ dobootstrap (http://localhost:8100/lib/ionic/js/ionic.bundle.js:10144:20)     @ bootstrap (http://localhost:8100/lib/ionic/js/ionic.bundle.js:10165:12) http://errors.angularjs.org/1.3.13/$injector/modulerr?p0=starter&p1=error%3…3a%2f%2flocalhost%3a8100%2flib%2fionic%2fjs%2fionic.bundle.js%3a10165%3a12) 

i did not include angular cdn because ionic includes it. created new app on firebase, , can access through firebase dashboard.

any ideas how firebase , running correctly?

you need move ionic.bundle.js before angularfire.min.js, because angular fire.js using angular object while creating module & throwing error.


Comments

Popular posts from this blog

node.js - Using Node without global install -

How to access a php class file from PHPFox framework into javascript code written in simple HTML file? -

java - Null response to php query in android, even though php works properly -