title: firebase.database reference not working
body: <p>I'm trying to use firebase realtime database in my ionic project. For some reason I'm not able to access the database after initializing the firebase app. I have added firebase-app and firebase-database CDNs and still it doesn't seem to work.
  head tag of my index.html looks like: </p>
  
  <pre><code>&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;!-- Firebase --&gt;
  &lt;script src="https://www.gstatic.com/firebasejs/3.1.0/firebase.js"&gt;&lt;/script&gt;
  
  &lt;script src="lib/ionic/js/ionic.bundle.js"&gt;&lt;/script&gt;
  
  &lt;!-- AngularFire --&gt;
  &lt;script src="https://cdn.firebase.com/libs/angularfire/2.0.1/angularfire.min.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;script src="https://www.gstatic.com/firebasejs/3.1.0/firebase-app.js"&gt;&lt;/script&gt;
  &lt;script src="https://www.gstatic.com/firebasejs/3.1.0/firebase-auth.js"&gt;&lt;/script&gt;
  &lt;script src="https://www.gstatic.com/firebasejs/3.1.0/firebase-database.js"&gt;&lt;/script&gt;
  
  &lt;script&gt;
    // Initialize Firebase
    var config = {
      apiKey: "api-key",
      authDomain: "domain",
      databaseURL: "url",
      storageBucket: "bucket",
    };
    firebase.initializeApp(config);
  &lt;/script&gt;
  
  &lt;script src="js/app.js"&gt;&lt;/script&gt;
  &lt;script src="js/controllers.js"&gt;&lt;/script&gt;
  &lt;script src="js/routes.js"&gt;&lt;/script&gt;
  &lt;script src="js/services.js"&gt;&lt;/script&gt;
  &lt;script src="js/directives.js"&gt;&lt;/script&gt;
  
  &lt;link href="lib/ionic/css/ionic.css" rel="stylesheet"&gt;
  </code></pre>
  
  <p></p>
  
  <p>And the functionality that I'm trying to implement is that I'm using a modal to submit a form which has addRide method on click:</p>
  
  <pre><code> .controller('homeCtrl', function($scope, $firebaseAuth, $firebaseArray) {
    $scope.authObj = $firebaseAuth();
    var dref = firebase.database().ref().child("rides");
    $scope.rides = $firebaseArray(dref);
    $scope.addRide = function(){
      $scope.rides.$add({
        //object
      })
     }
    })
  </code></pre>
  
  <p>EDIT:</p>
  
  <p>It worked after I separated the modal controller from its parent page. I'm able to add the object using add but for some reason the webstorm intellisense is still not picking up database().</p>