AngularJS services are singletons that carry out specific tasks common to web apps. AngularJS provides a range of built-in services, along with the ability to create custom services as required. Services are also used for communication between application components through dependency injection ...

learn more… | top users | synonyms

3
votes
0answers
1k views

AngularJS testing: Mocking $httpBackend - Handling Success and Error Methods

Update: I managed to further narrow down the problem scope and fix the Unexpected request error by updating the httpBackend.when request which contained some invalid ascii characters. I have attached ...
3
votes
0answers
333 views

How to handle many to many relationships with Angularjs' $scope variable

I have two services that hold my two objects which have a many to many relationship; Missions (or steps/actions) and the Tools needed for these Missions. Each Mission can use many tools and each Tool ...
2
votes
0answers
58 views

Angularjs factory/service management

We are working on a large scale application based on angularjs, now based on some best practices we develop a model using factory services, such that it can be shared across controllers. Since, we ...
2
votes
0answers
98 views

AngularJS service storing and updating data

I have a simple app that shows a list of people each with a link to an edit controller. The edit controller gets the person by id. Once the edit form has been submitted, the page is redirected back ...
2
votes
0answers
117 views

Virtual URL in angularJs with routeProvider

I have a list of items app/#/items, and a form to filter the item by the location that it's located in. I use dirty checking to trigger a method of a service that communicates with the Backend and ...
1
vote
0answers
25 views

The correct way to communicate between these things in AngularJS

I am searching the correct way to communicate between these things in AngularJS : Controller vs. Controller Directive vs. Directive Directive vs. Controller I would love to know what the best ...
1
vote
0answers
54 views

Testing factories (services) in AngularJS

I have tried several combinations to test my factory but always get errors in the view SpecRunner.html. So let's have a look at my factories and the tried unit tests. //First service who ...
1
vote
0answers
46 views

AngularJS - Google maps ui-sref inside of a marker

Hi I'm having google maps in angular and I'm trying to make custom marker.content with a button to get to another route. I'm setting merkers in service like this this.setMarker = function (item, map) ...
1
vote
0answers
81 views

Widget design in angularjs

In the past week I am trying to learn Angular JS. I mostly used jQuery on my projects so I am having hard time trying to get its concept. I decided to make a simple admin panel using angularjs for ...
1
vote
0answers
48 views

Issue with getting new data from http call and automatic reload

In my ionic app I have two services Studies and Collections. Studies makes a http call to get a json object which gets a JSON array object which I iterate through and display on the html page. Here is ...
1
vote
0answers
51 views

WCF Rest service with datacontract parameter from Angularjs is not getting called?

Angular JS: This is my angularJS service call from UI client var obj = { "ReportingId": Rejection.ReportingId, "ErrorCode": Rejection.ErrorCode, ...
1
vote
0answers
77 views

AngularJS how to configure Provider between 2 modules?

Please see my proof of concept: http://plnkr.co/edit/y3pzFv?p=preview. How Do I configure Provider between 2 modules? Brief: I am trying to generalize a service and configure multiple instances ...
1
vote
0answers
76 views

Keep service in sync with 2 controllers

Our app has a service campaign that is used in our main product controller, after being resolved by the router. MainCtrl: $scope.campaign = campaign; $scope.campaign.someProp = dynamicPerProduct(); ...
1
vote
0answers
29 views

Returning data from service dependancy using promises causes $digest iteration error

I have two services where one needs to query the other by an id for example. This is what I currently have but I'm getting $digest iteration limits. "Error: [$rootScope:infdig] 10 $digest() ...
1
vote
0answers
57 views

why angular service attribute changes can not affect the relative value in the controller scope?

Here is my code brief: controller: angular.module('testApp').controller('TestCtrl', function ($scope, EssayRsc, EssaySvc) { $scope.pageInfo = EssaySvc; } service: ...
1
vote
0answers
142 views

Bind JSON data into Morris linechart Directive using AngularJs Services

I am trying to show linechart by using webapi. Static data showing successfully but when I trying to bind JSON data array by calling services it not showing . When I binding static data into ...
1
vote
0answers
145 views

Angularjs, dynamic call to service using promises (q service) causing issue for compiling nvd3 charts

In my Angularjs application I am using tabs. Upon selecting Recovery tab I need to display nvd3 charts dynamically. So in my controller I am dynamically creating the template to compile, based on the ...
1
vote
0answers
321 views

AngularJS HTML audio player

I'm creating a webpage using AngularJS. I am trying to play an audio file that is loaded when the page has finished loading. This is the html code I'm using: <audio controls="controls"> ...
1
vote
0answers
203 views

ng-click event not defined after $compile in google maps infowindow

Within this angular google map, I want to give the ability for a link to appear in a dynamic infowindow thats generated when the user searchs an address. Now Ive got the infowindow to load correctly ...
1
vote
0answers
211 views

Bind Service 'getter' or $watch changes and update manually - AngularJS

In my AngularJS app I'm using a service to store info that's being updated by a simple polling mechanism. Then, my controllers/directives are reading from that service, so that I can have that model ...
1
vote
0answers
153 views

How do you update a cached resource in an angular service?

What is a good pattern for updating angular data from a ngResource service that has been cached? I been trawling posts like this one [1]: How to refresh / invalidate $resource cache in AngularJS, but ...
1
vote
0answers
179 views

angularjs - $resource cookie phpsessid changes every server request

I use $resource to login to a (Yii) php backend. After the login I want to retreive all cars (for example). BUT the received cookie, contains a different PHPSESSID every request. How can this problem ...
1
vote
0answers
343 views

AngularJS: window service and directive

I'm learning AngularJS and I want to create a custom service and directive to show window view which I can close, minimize, maximize, drag and resize. I wrote something but I am not sure if this is ...
1
vote
0answers
58 views

How to prevent calling of a service when hitting refresh button

I have problem in angular. I have made a service that should authenticate the user that service has two variables which are var isAuth and var IsAdmin;which indicates the state of the user. In the ...
1
vote
0answers
57 views

How can I listen for dependency injection inside an angularjs service?

I am attempting to write a service for angular and would like to perform a function inside my service each time I inject it into something else (in this case, to keep track of certain data that will ...
1
vote
0answers
89 views

Restangular update call when options change

My services.js angular.module('myApp.services', []). factory('MyApi', function (Restangular) { var options = {quran: 210, content: 217, audio: 1}; var callBack = 1; return { ...
1
vote
0answers
52 views

Injecting an annotated Service in a Provider in Angular

I would like to use a Service in a Provider. I'm not sure it's the right way to go. I've managed to instantiate a service in a provider, by injecting the service provider instead, and calling its ...
1
vote
0answers
116 views

Pattern? Encapsulating an array in an AngularJS service

I have an AngularJS service that is keeping track of an array of items, which are added and removed through exposed methods by several controllers. Surely, the view should always have the latest data. ...
1
vote
0answers
68 views

Angular $q.defer breaking after moving to 1.2

I have this Angular snippet which was working fine under Angular 1.0.8. I just switched to 1.2 and now, although I don't see any errors, I get no objects in the html. // --- CONCERNS FACTORY --- // ...
1
vote
0answers
36 views

PersonController issues

Following is the code of my person controller demoApp.controller('PersonCntrl', function ($scope, $route, $location, Person) { $scope.newPerson = {}; $scope.createdPersons = Person.getAll(); ...
1
vote
0answers
533 views

AngularJS - “10 $digest() iterations reached” when ng-view ng-repeat dependant on $routeParams

I am really new to Angular and this is the first time that I am dealing with routing, so please excuse me if my questions are a bit confusing. My actual logic and structure for this app is much more ...
1
vote
0answers
301 views

AngularJS: What is proper way of serving async AJAX request without $http

Assume we have some service that fetch data from server. It's async and is not using AngularJS $http service. When we deal with async stuff in Angular - we use $q promises. But there is one problem: ...
1
vote
0answers
607 views

AngularJS: Sample ToDo App - Questions and Review

I know there are tons of AngularJS ToDo apps/topics out there and I've read quite a few of them to get a basic understanding of AngularJS, how things work and the idea people put behind their code. ...
0
votes
0answers
22 views

Need clarification of angular architecture for editor

Edited: Tried to simplify the posting I need to create a simply github-flavored markdown "editor" with the following basic (typical) features Preview panel that shows converted markdown text An ...
0
votes
0answers
7 views

$jsonbackreference and @jsonmanagereference

due to @jsonbackreference and @jsonmanagereference i'm got error like unsupported media type 415 on post json data from angular js ,my controller look like as @RequestMapping(value = "/save", ...
0
votes
0answers
17 views

How to mock a resource in angular.js controller testing

I have the following test: 'use strict'; describe('cities', function() { beforeEach(module('myApp.cities')); var $controller, $q, $rootScope, $scope; ...
0
votes
0answers
32 views

Angular JS service prototype - why not return new() instead of using factory

I follow Object-oriented AngularJS Services article to implement some OOP in my Angular JS services. Author of this article uses first factory then injects it to service - but why not return new() ...
0
votes
0answers
33 views

angularjs access link function of directive from external controller

i have two ng-include in a template, but similar: <ng-include ng-controller="ctrTable" src="modal.html"></ng-include> <ng-include ng-controller="ctrButton" ...
0
votes
0answers
20 views

jasmine: Mocking angular service yields timeout

I am trying to test an angular service. The service is using another service and I would like to mock that one. Let's say I have a service myService that depends on the service myOtherService. When ...
0
votes
0answers
18 views

Chaining $resource calls in Factory not working

I have something that is driving me crazy. To have a cleaner code base I want to chain a number of $resource calls together in a single Factory. I've seen this done, and actually successfully did it. ...
0
votes
0answers
8 views

Twitter Signature not showing

I am trying to put together a quick twitter signature on my already authorised/functioning app. It currently loads all the latest twits from my user's homepage with a getLatestTwits function inside a ...
0
votes
0answers
75 views

Testing a simple REST service with Jasmine (AngularJS)

After trying many samples I'm coming to end. I don't know what to do that the test is working.. I've tried the following to test: //CrudService who is invoked in the Ctrl angular.module('myApp') ...
0
votes
0answers
58 views

TypeError: r.details is not a function

I have a strange problem with a call I'm making to a Factory, where I am populating a form. I'm getting an error "TypeError: r.details is not a function". I have the exact same syntax setup in another ...
0
votes
0answers
28 views

Getting 401 error when call $http POST and passing data

I am calling a Web API 2 backend from an angularjs client. The backend is using windows authentication and I have set up the $httpProvider to use credentials with all calls and it works fine for all ...
0
votes
0answers
14 views

Initialize AngularJS service with asynchronous connection to SignalR

I have an angular service but it didn't work. Because it returning before connection established to the server. How will I change it and make working service? (function () { 'use strict'; ...
0
votes
0answers
12 views

User case of prototypical inheritance in service methods in angularjs

What is the use case that one may need to use prototypical inheritance (on anything) when create an angularjs service? I was ask to do so when writing a service's methods. However, I am not sure if ...
0
votes
0answers
81 views

AngularJS Add or Edit view in a Single Controller

I have a couple of view pages that use the same controller called "Account". I'm using the UI Router for my navigation states. In one of my navigation state, I have initialized a Resolve Method that ...
0
votes
0answers
54 views

Can't access Resource object in promise response array - always undefined (AngularJS)

I have two service which depend on each other. As a consequence, I want to use promises. Here is my code: var defer = $q.defer(); var promiseUsers = Users.get({id: $routeParams.id}); var ...
0
votes
0answers
26 views

AngularJS $http using service fired on Events

i am using angular services to get the data from the server. the problem is when the app is init then the default data is shown for 1 -2 days. Then there are "click" events. on teh page. for every ...
0
votes
0answers
45 views

Angularjs with SOAP Services returns response = “false”

I am trying to make a service call using SOAP services with AngularJS which is checking if the username and password are correct. I am using glassfish v2 and SQL Server 2012 where the usernames and ...