Linked Questions
14 questions linked to/from AngularJS : When to use service instead of factory
2
votes
1
answer
932
views
Should I use factory or service for fetching data in AngularJS? [duplicate]
I'm learning AngluarJS and I have a very simple project set up.
I have a file called ApiService.js which is used to pull data from a RESTful server somewhere. At the moment it looks like this:
var ...
0
votes
0
answers
74
views
When should I use factory or service in angular? [duplicate]
I am new to Angular services/factory.
This is my simple angular service & factory. Both outputs the same.
//defining service
app.service('myService', function () {
this.name = '';
this.setName = ...
3426
votes
30
answers
786k
views
AngularJS: Service vs provider vs factory
What are the differences between a Service, Provider and Factory in AngularJS?
1082
votes
9
answers
348k
views
angular.service vs angular.factory
I have seen both angular.factory() and angular.service() used to declare services; however, I cannot find angular.service anywhere in official documentation.
What is the difference between the two ...
224
votes
4
answers
256k
views
AngularJS : Factory and Service? [duplicate]
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. ...
40
votes
2
answers
39k
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(['$...
23
votes
2
answers
30k
views
AngularJS and WebSockets beyond
I just read this post, and I do understand what the difference is. But still in my head I have the question. Can/Should I use it in the same App/Website? Say I want the AngularJs to fetch content and ...
1
vote
2
answers
4k
views
AngularJS : Service variable changes not applying
Im currently having an issue where when I call a function in a service that changes its own internal variable it doesn't appear to stay unless I change it from a controller. When I output the variable ...
0
votes
1
answer
3k
views
Changing $scope variable value in controller not changing value on view
I am working on Cordova tool and angularjs for my application.
cordovaApp.controller("VacationCtrl", function ($scope, $http, $location) {
$scope.tempdate = "2222";
$scope.ruleDetails ...
0
votes
3
answers
627
views
Angularjs - Cross Controller Calculation
I am trying to create an application with Angularjs, It's a fairly large application which needs to be broken down into multiple Controllers. I need to calculate across controllers.
angular....
0
votes
2
answers
492
views
Transfer some data from one controller to another, or how to change controller to service
How can i take information from one controller to another, or how can i make service from a controller? I need to take coordinates and save it to object with some other variables, if i put dependencie ...
1
vote
3
answers
334
views
use angular factory to hold a value for rest of application to access to minimize server calls
I have the following factory:
angularModule
.factory('ArticleCategoryService', function ($http, $q) {
// Service logic
// ...
var categories = [];
var _getCategories = $http.get('/...
0
votes
1
answer
109
views
AngularJS - Why use a service?
I have been using AngularJS on a new project and I really like it. So much so I think I will do all my future web projects with it. I have done lots of reading on the different types of Provider there ...
-3
votes
1
answer
62
views
Create a custom http service that will request external JSON file. pure angularjs only
I have a http service which will call external json files and load it into a grid.
My problem is i need to create a custom http service so that i could use the same in different controllers. The ...