angularjs-service Questions

5

How can I stop a request in Angularjs interceptor. Is there any way to do that? I tried using promises and sending reject instead of resolve ! .factory('connectionInterceptor', ['$q', '$timeo...
Threewheeler asked 24/8, 2014 at 15:53

25

Solved

This is my demo using angularjs, for creating a service file, and adding service to a controller. I have two problems with my demo: One is when I put <script src="HomeController.js"> befor...
Opuscule asked 17/9, 2014 at 15:58

5

Solved

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] htt...

13

Solved

I'm trying to build my own service by following the example in the documentation for the factory methodology. I think I've done something wrong however because I continue to get the unknown provide...
Contiguity asked 29/5, 2014 at 20:27

3

Solved

Angularjs docs give the usage of $controller service as: $controller(constructor, locals); Can anyone focus some light on these 2 points: When to use $controller service. Please provide some use...
Menu asked 9/1, 2015 at 18:11

7

Solved

I know how to intercept ALL requests, but I only want to intercept requests from my resources. Does anyone know how to do this? services.config(['$httpProvider',function($httpProvider) { $httpPr...
Picrate asked 11/4, 2014 at 19:51

3

Solved

I am using socket.io to enable chat in my app and i am using a service SocketService to perform all the socket stuff. When a message came then i want to trigger a function of a controller from the ...

2

Solved

Supposed I have two modules for AngularJS, e.g. foo and bar, and both of them define a service called baz. In my application I depend on them by saying: var app = angular.module('app', [ 'foo', '...
Brambling asked 25/7, 2013 at 15:23

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

3

Solved

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

4

Solved

I've recently switched all our modals directives in our app over to Angular-ui-Bootstrap modals. Much better, however running into a new style of modal which closes on mouseleave instead of a cance...

4

Solved

Is it possible to set up a $watch on an array of objects inside a service (I'd like the $watch declaration itself to be inside the service)?
Nedi asked 23/7, 2013 at 9:38

4

Solved

I have a service like: angular.module('app').factory('ExampleService', function(){ this.f1 = function(world){ return 'Hello '+world; } return this; }) I would like to test it from the JavaSc...
Venial asked 20/3, 2013 at 15:28

3

Solved

I am using the Angular UI bootstrap modal dialog and create it within a service: myApp.factory('ModalService', ['$modal', function($modal) { return { trigger: function(template) { $modal.open({...

5

Solved

I am very new to angularJS. I am searching for accessing services from RESTful API, but I didn't get any idea. How can I do that?
Dimmer asked 6/5, 2013 at 7:31

30

Solved

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

2

Solved

I'm trying to get some data from a Service into a Controller and I keep get an undefined variable. angular .module("classes") .service("MyService", function ($http) { this.foo; $http.get("/cl...
Commeasure asked 21/9, 2017 at 10:38

4

Solved

Other posts on this error always include someone trying to $apply without using a safe apply, but that's not the case in my example. My function IS successfully returning the data I requested from ...

10

Solved

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

5

Solved

I've got the following service: angular.module("services") .factory("whatever", function($window) { return { redirect: function() { $window.location.replace("http://www.whatever.com"); } }; }...

4

Solved

I'm trying to make a single $http request to get one of my JSON files and use the data across all my controllers. I saw on egghead.io how to share data across multiple controllers, and I've also r...
Zadazadack asked 22/8, 2013 at 10:3

3

Solved

Is it possible to inject one service into another service in angularJS?
Gynecologist asked 8/1, 2014 at 19:27

4

Solved

I have the following angularjs service: angular.module('app.main').factory('MyService', ["$http", function ($http) { return new function () { this.GetName = function () { return "MyName"; }; ...
Clactonian asked 26/6, 2013 at 12:17

2

Solved

Here is the idea: So I am trying to use an external library function to create some manipulation in the DOM in one of my controllers that my ng-repeat is connected to. Newest jsFiddle working bu...

2

Solved

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...
Uncouple asked 4/7, 2012 at 7:19

© 2022 - 2024 — McMap. All rights reserved.