title: Uncaught ReferenceError: angular is not defined angularfire.min.js:12 Uncaught ReferenceError: angular is not defined + Angular + Ionic
body: <p>I am getting below errors:</p>
  
  <pre><code>**angularfire.min.js:12 Uncaught ReferenceError: angular is not defined
  angularfire.min.js:12 Uncaught ReferenceError: angular is not defined
  
  ionic.bundle.js:17697 Uncaught Error: [$injector:modulerr] Failed to instantiate module app 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.**
  </code></pre>
  
  <p>while running ionic app in device. I got above error via chrome://inspect.</p>
  
  <p>But app works perfect in web view(ionic serve).</p>
  
  <p>Index.html file:</p>
  
  <pre><code>&lt;html&gt;
    &lt;head&gt;
      &lt;meta charset="utf-8"&gt;
      &lt;meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width"&gt;
      &lt;title&gt;&lt;/title&gt;
      &lt;!-- AngularFire --&gt;
      &lt;script src="https://cdn.firebase.com/libs/angularfire/1.2.0/angularfire.min.js"&gt;&lt;/script&gt;
  
      &lt;!--script src="angular.min.js"&gt;&lt;/script--&gt;
      &lt;!-- Firebase --&gt;
     &lt;script src="https://www.gstatic.com/firebasejs/live/3.0/firebase.js"&gt;&lt;/script&gt;
      &lt;script&gt;
      // Initialize Firebase
      var config = {
      apiKey: "xxxx",
      authDomain: "xxxx.firebaseapp.com",
      databaseURL: "https://xxxx.firebaseio.com",
      storageBucket: "xxxx.appspot.com",
      };
    firebase.initializeApp(config);
  &lt;/script&gt;
  
  
  
  
  
      &lt;script src="lib/ionic/js/ionic.bundle.js"&gt;&lt;/script&gt;
  
      &lt;!-- cordova script (this will be a 404 during development) --&gt;
      &lt;script src="cordova.js"&gt;&lt;/script&gt;
  
      &lt;!-- IF using Sass (run gulp sass first), then uncomment below and remove the CSS includes above
      &lt;link href="css/ionic.app.css" rel="stylesheet"&gt;
      --&gt;
  
  
      &lt;link href="lib/ionic/css/ionic.css" rel="stylesheet"&gt;
  </code></pre>
  
  <p>app.js:</p>
  
  <pre><code>var db = null;
  angular.module('app', ['ionic', 'app.controllers', 'app.routes', 'app.directives','app.services','ngCordova','firebase'])
  
  .run(function($ionicPlatform,$cordovaSQLite,$rootScope, $firebaseAuth, $firebase, $window, $ionicLoading,$cordovaGeolocation,$interval) {
    $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 &amp;&amp; window.cordova.plugins &amp;&amp; window.cordova.plugins.Keyboard) {
        cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
        cordova.plugins.Keyboard.disableScroll(true);
      }
  </code></pre>
  
  <p>controller.js:</p>
  
  <pre><code>angular.module('app.controllers', [])
  
  
          .controller('mobileCtrl', ['$scope', '$rootScope','$stateParams','SendSMSFactory','VcodeStorageService',// The following is the constructor function for this page's controller. See https://docs.angularjs.org/guide/controller
      // You can include any angular dependencies as parameters for this function
      // TIP: Access Route Parameters for your page via $stateParams.parameterName
      function ($scope,$rootScope,$stateParams,SendSMSFactory,VcodeStorageService) {
  </code></pre>
  
  <p>I am not sure, whats wrong over here.
  I tried replacing cdn links of angular file, by manually placing them in js folder and changing the link accordingly. But no luck.</p>
  
  <p>other post which had similar issue, their solution was to add angular file in index.html.
  But i already have it.</p>
  
  <p>Please help.</p>