So I am sure I am not using best practices, but, I'm just trying to get this to work. I'm making a note taking app, and for whatever reason, the service I created, returns
undefined
angular.module('notesService', []).factory('Notes', ['$http', function($http){
return {
get : function(){
var notes = $http.get('/api/notes');
return notes;
}
}
}]);
angular.module('mainController', [])
.controller('mainController', function($scope, Notes){
console.log(Notes.get());
});
e {
$$state : {
status : 1,
value : {
config : Object,
data: Array[10]
}
}
}
$$state.value
undefined
You have the service in an entirely different module. So you gotta inject notesService
into angular.module('mainController', [notesService])
.
You dont ideally need to add new module for each controller and services, you can have single module and add everything to it