I have completely stumped myself with trying to instantiate a factory in my controller. No matter what I do it seems my factory ('FBRetrieve') is undefined. It must be something very simple, but can't seem to find a solution via S/O search/google/angulardocs.
app.js
var legalmvc = angular.module('legalmvc', ['ngRoute','FireBaseService']);
factory.js
angular.module("FireBaseService", []).factory('FBRetrieve', function(){
var biblioData = new Object();
biblioData.getData = function(type){
var biblioRef = new Firebase('https://legalcitator.firebaseio.com/'+type);
biblioRef.on('value', function(data) {
if (data.val() === null) {
console.log("ERROR");
return;
}
console.log(data.val());
biblioData = data.val();
});
return biblioData;
};
});
and in the controller I'm instantiating with something like this:
legalmvc.controller('FormCtrl',["$scope","FBRetrieve", function ($scope, FBRetrieve) {
$scope.FBRetrieve = FBRetrieve.getData('case');
.....