rangma rangma - 5 months ago 46
AngularJS Question

"firebase" is not defined in generator-gulp-angular

I am using

generator-gulp-angular

I added firebase and angularfire with

bower install firebase --save
bower install angularfire --save


Then I added firebase in the module as below.

angular.module('myApp', ['firebase']


Then in the MainController, I defined config and initialized as below.

vm.config = {
apiKey: "yuygjgjhghjguyfuyfuyccncvcn",
authDomain: "hjgjhghjghjg.firebaseapp.com",
databaseURL: "https://hjghjgjhghj.firebaseio.com"
};

function activate() {
getWebDevTec();
getMenu();
firebase.initializeApp(vm.config);
$timeout(function() {
vm.classAnimation = 'rubberBand';
}, 4000);
}


When I do
gulp serve
, But I am getting below error.

29:7 error "firebase" is not defined no-undef


Could you please suggest where I am going wrong.

Answer

Make sure you inject the firebase service into your controller