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?
13
votes
2answers
1330 views

Is this a "Deferred Antipattern"?

I'm finding it hard to understand the "deferred antipattern". I think I understand it in principal but I haven't seen a super simple example of what a service, with a differed promise and one with ant...
13
votes
3answers
38805 views

Angularjs Uncaught Error: [$injector:modulerr] when migrating to V1.3

I am learning Angular.js and I am not able to figure out whats wrong with this simple code. It seems to look fine but giving me following error. **Error**: Uncaught Error: [$injector:modulerr] http:/...
106
votes
7answers
87881 views

Injecting a mock into an AngularJS service

I have an AngularJS service written and I would like to unit test it. angular.module('myServiceProvider', ['fooServiceProvider', 'barServiceProvider']). factory('myService', function ($http, fooS...
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...
215
votes
10answers
91725 views

How do I configure different environments in Angular.js?

How do you manage configuration variables/constants for different environments? This could be an example: My rest API is reachable on localhost:7080/myapi/, but my friend that works on the same co...
53
votes
6answers
42197 views

Cordova + Angularjs + Device Ready

I am developing a mobile application using Cordova and AngularJS. How do I restrict bootstrapping of AngluarJS before Cordova device ready. Basically I don't want to use any of AngularJS controllers b...
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...
37
votes
2answers
31903 views

Creating common controller functions

How do I create some sort of utils bundle that would be accessible from all my controllers? I have this route code in my main module: 'use strict'; angular.module('lpConnect', []). config(['$ro...
155
votes
10answers
103643 views

AngularJS : The correct way of binding to a service properties

I’m looking for the best practice of how to bind to a service property in AngularJS. I have worked through multiple examples to understand how to bind to properties in a service that is created usi...

Previous Next