angularjs-factory Questions

3

Solved

I'm following the Tutorial from the official AngularJS docs and I want to know if I can add another function to the Phone factory so that I can organize code better. They have declared a "query" fu...
Neither asked 17/2, 2014 at 5:3

9

Solved

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 c...
Router asked 22/9, 2013 at 2:35

1

I have a controller as shown below. (function () { "use strict"; var app = angular.module('Demo') .controller('MainController', ['$rootScope', '$scope', '$location', 'curUser',MainController]); ...
Compressive asked 7/12, 2018 at 14:34

4

Solved

I've been doing a lot of work on Angular.js and overall I find it to be an interesting and powerful framework. I know there have been a lot of discussions on Services vs. Factories vs. Providers vs...
Phenylketonuria asked 16/5, 2013 at 20:10

30

Solved

What are the differences between a Service, Provider and Factory in AngularJS?

1

Edit 1: Guys, I notice that I call $http.get('/posts') (for some special purpose) in my authentication factory. Sorry for the stupid question. I will delete it when the bounty is end. I have the f...
Talamantes asked 18/4, 2017 at 0:10

2

Solved

I have a module... angular.module('myModule', []); And then a factory angular.module('myModule') .factory('factory1', [ function() { //some var's and functions } ]); And then another factor...
Dacoit asked 16/4, 2014 at 16:56

3

Solved

I read these two great articles: The state of angularjs controllers by Jonathan Creamer and Rethinking AngularJS Controllers by Todd Motto In these articles, the authors talk about the right wa...

2

Solved

I am wondering how can I rewrite the following factory into a TypeScript code. Here is the original code: app.factory('errorInterceptor', function ($q) { return { responseError: function (respo...
Wakerly asked 17/11, 2015 at 14:39

1

Solved

I have the following method getData(url) in a my factory which uses $http.get(url) to get data from an URL angular .module('az-app') .factory('WebServiceFactory', function ($http, $q) { var We...

2

Solved

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 = ang...

1

Solved

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 angul...

1

Solved

My single page application has 2 controllers : the first is for my main menu and the second is for the view. They share data with this factory myApp.factory('MenuFactory', function(){ var factory ...

4

Solved

My factory looks like: 'use strict'; angular.module('myApp') .factory('httpInterceptor',['$q','$location', '$rootScope', function($q, $location, $rootScope){ return { response: function(respon...
Waltz asked 21/10, 2013 at 15:59

5

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...
Salvador asked 9/5, 2013 at 0:10

2

Solved

I have a controller and factory defined as below. myApp.controller('ListController', function($scope, ListFactory) { $scope.posts = ListFactory.get(); console.log($scope.posts); }); myApp.fac...
Annamaeannamaria asked 29/7, 2013 at 20:21

2

Solved

I am starting with AngularJS and i am having some issues when trying to use a factory from a controller. I have the following factory angular.module('testingApp') .factory('factoryService', func...
Vassalize asked 9/10, 2014 at 15:0

3

Solved

What is the best practice when you have a Factory with like 4 related methods, each of those is really long (200+ lines of code) and you want to avoid having a huge file of 800+ lines of code? One...
Clarence asked 16/9, 2014 at 12:16

3

Solved

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...
Proctoscope asked 21/3, 2014 at 14:48

2

Solved

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 follow...
Cavender asked 6/8, 2014 at 14:51

4

Solved

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 t...
Becalmed asked 15/4, 2014 at 4:47

2

Solved

I am trying to build a factory to act as a staging area for my database models, as well as an api to perform basic CRUD calls. I want to be able to access data by storing it in a service or a facto...

2

I am simply trying to load data when my app starts. However, the view loads faster than the http request(of course). I want to refresh my view once my data has been properly loaded because that dat...

1

Solved

I am new to angular js. I am trying to call factory service method 'getScoreData' from ng-change of select, but not able to get it done. please help. Html code: <select ng-model="Score" ng-cha...

2

Solved

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 d...
Mitrewort asked 17/8, 2013 at 3:19

© 2022 - 2024 — McMap. All rights reserved.