All Questions

3059
votes
30answers
718534 views

AngularJS: Service vs provider vs factory

What are the differences between a Service, Provider and Factory in AngularJS?
278
votes
8answers
109542 views

AngularJS : When to use service instead of factory

Please bear with me here. I know there are other answers such as: AngularJS: Service vs provider vs factory However I still can't figure out when you'd use service over factory. From what I ca...
173
votes
4answers
177579 views

AngularJS : Factory and Service?

EDIT Jan 2016: Since this still gets attention. Since asking this I've completed a few AngularJS projects, and for those I mostly used factory, built up an object and returned the object at the end. M...
13
votes
2answers
4880 views

Error: Unknown provider: employeesProvider <- employees

I am having a heck of a time trying to figure out why I'm getting the Unknown provider error in Angular. I've checked every other question I could find on the subject and most suggest an error in depe...
5
votes
4answers
5966 views

$location.path doesn't change in a factory with AngularJS

My factory looks like: 'use strict'; angular.module('myApp') .factory('httpInterceptor',['$q','$location', '$rootScope', function($q, $location, $rootScope){ return { response: function(...
8
votes
1answers
24813 views

Angular - TypeError: XX is not a function

Maybe I'm missing some kind of property, but I'm follow this project and I'm getting this error in my controller. TypeError: loginService.signin is not a function This is my controller.js angular....
15
votes
5answers
8918 views

How can I extend the constructor of an AngularJS resource ($resource)?

I have a model, defined using $resource, that I am successfully loading. Each loaded instance is, as promised, an instance of the class I defined. (The example below is from the Angular docs. In it...
17
votes
3answers
29243 views

AngularJS Factory Parameter

I'm trying to send a parameter to an angularjs service. Here is my service code : angular.module('skyBiometryServices', ['ngResource']) .factory('Facedetect', function( $resource ) { return $reso...
6
votes
2answers
32351 views

AngularJS : returning data from service to controller

I am trying to create a service to get json and pass it to me homeCtrl I can get the data but when a pass it to my homeCtrl it always returns undefined. Im stuck. My Service: var myService = angula...
0
votes
2answers
747 views

Correct way to make a factory module in angularJs

I have a controller function like this: $scope.localTimezone = function (userTimezone,datetime) { // .... return data; } What is the correct way to make it a factory module? I tried the followi...

Previous Next