0
votes
1answer
27 views

angularjs scope two values keeping pointing to each other

Hi I'm trying to copy a scope value from one to another scope. For example: var items=$scope.order.invoicewindow.items; $scope.order.orderwindow.items=items; However right both scopes are ...
1
vote
2answers
30 views

AngularJS call common controller function from outside controller

My basic premise is I want to call back to the server to get the logged in user in case someone comes to the site and is still logged in. On the page I want to call this method. Since I am passing ...
0
votes
1answer
19 views

update directive from service

I would like my directive to be updated as soon as my model in the service get modified. I can not achieve it yet: service: function pickerService(){ // picked elements // do ...
0
votes
4answers
27 views

angularjs maintain the scope variable across routes

How do I maintain the model across routes. for eg I have a list of profiles loaded onto the home page. The home page also contains a "load more" action to load more profiles, basically pushing data to ...
0
votes
4answers
30 views

update a service variable within an $http callback

I'm using a service to make user data available to various controllers in my Angular app. I'm stuck trying to figure out how to use the $http service to update a variable local to the service (in my ...
0
votes
1answer
25 views

angularjs service scope issue after directive event listener callback

I am trying to use an event listener in my angular directive along with a service. I am having a scope issue as I want 'this' to refer to my service's 'this'. Right now, in my service, 'this' ...
0
votes
1answer
27 views

How to access Service in $httpProvider

I created a config service to provide environment specific configurations. I'm using the $httpProvider to intercept and extend the request url with a API Base Url but how do i access the config ...
0
votes
1answer
19 views

What is the proper way to create a method with a dynamic number of parameters within an angularjs service?

I'm currently using a custom AngularJS service to enable calling remote methods on my server-side. The wrapper service is intended to simplify calling these methods in my controllers, and returns a ...
0
votes
1answer
27 views

updating controller over service not updating view

in my app I have an "Maps" to show and handle things on maps. A CtrlMap controller display the map and shows an marker. The watchPosMap watches position changes. 3rd there is an service called ...
0
votes
0answers
23 views

Creating a service with $resource as a class

I have an AngularJS service to communicate about things with my REST API. services = angular.module 'MyApp.services' services.factory 'Things', ['$resource', ($resource) -> r = $resource ...
0
votes
1answer
17 views

AngularJS: Way to define a large $watchCollection?

This post is not the same as: Is there a tidy way to define a large watch collection for AngularJS? My code is (service.js): var MyJSON = { array: [ {k:'v'}, {k:'v'}, ...
1
vote
1answer
28 views

What is the difference between Class actions and Instance actions in AngularJs?

From the docs: Class actions return empty instance (with additional properties below). Instance actions return promise of the action The documentations however doesn't clearly differentiate ...
-1
votes
1answer
24 views

AngularJs: $resource: Unexpected behaviour while using $query action method

I am trying to fetch data using query action method from a restful service using Angular $resource When I use the default query method as MyService.query(); I have received the following error: ...
0
votes
2answers
21 views

angularjs: Customizing resource

I am following https://github.com/StarterSquad/startersquad.github.com/tree/master/examples/angularjs-requirejs-2 folder structure in my app inside services i have added following code ...
0
votes
0answers
26 views

Why do we need Angular $resource “get” and “not-get” actions?

AngularJS documentation (https://docs.angularjs.org/api/ngResource/service/$resource) states that: **The action methods on the class object or instance object can be invoked with the following ...
1
vote
0answers
11 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
2answers
60 views

Angularjs: Singleton service using $http [closed]

is it possible in angular to create service using $http which will take method, url, success and failure callback as parameters when called from controller. I want to achieve following kind of ...
0
votes
1answer
18 views

Angular provider not loading

i'm having some issues loading my providers. setup is as follows: ng-view with main.html main.html has controller MainCtrl I have several directives which need access to the same data, so i'm using ...
0
votes
1answer
60 views

Inserting a directive from another directive's compile function

I want to dynamically insert the <confirmation> element in the DOM from the updater directive. (I have it setup to tap into an event, which it does in my real app) I just need that element ...
0
votes
2answers
54 views

AngularJS for loop not waiting for modifications to $scope

I've been wracking my brain over this for a few days, so I figured it's time to finally ask somebody who actually knows what they're doing. ;) I'm building an AngularJS app and getting an odd ...
0
votes
1answer
15 views

AngularJS: function always evaluates to false because of Async nature of service

My Template looks like <div data-ng-if="budgetSummaryExists()"> <span>You have not budget</span> <button type="button" class="btn btn-danger" ...
0
votes
1answer
30 views

How does $injector service inject itself in AngularJS

An AngularJS app depend on the $injector service to inject other built-in or customize services in controller,directive or other injectable things, but how $injector service inject itself,just like : ...
1
vote
2answers
26 views

AngularJS: Recommendation on rendering different view when HTTP 404

What I am doing I am trying to create a service which loads the user budgets for current month. The code looks like $scope.thisMonthBudgetSummary = function () { console.log('retrieving ...
0
votes
1answer
36 views

How to inject my service into my controller angular js

I am relatively new to angular JS and I have an issue with angularJS 1.3.0 beta build I am trying to insert my service (a standalone module) to a controller. This is my app Code 'use strict'; ...
0
votes
3answers
61 views

Getting “Unknown Provider” while injecting service into controller

I have my App: 'use strict'; angular.module('ProjectTracker', [ 'App.controllers', 'App.services' ]) My Service: angular.module("App.services", []) .factory('ProjectManager', function () { ...
0
votes
0answers
32 views

angularjs on loadmore append to existing model using ng-repeat by caling a service

I have a profile page where in the model is loaded by a call made through a service via php that returns profiles, on click of load more how do I push data to the existing model and update the data. ...
0
votes
1answer
26 views

AngularJS View Not Updating Using Defer and Factory

I am currently having an issue where when I try to create a new setting my view is not being updated until I refresh the page. Can anyone point me into the right direction? If I am going about this ...
0
votes
1answer
22 views

constructor injection in angularjs

what is the correct way to do constructor injection in angularjs for instantiating objects with a factory or a service and invoke in a controller? Ref : http://docs.angularjs.org/guide/providers If ...
0
votes
2answers
36 views

angularjs - constructor injection with arguments

I'm trying to instantiate an object using the angular.factory recipe. The factory code is something like this monevAppServices.factory('MonEvChartService', ['element','chartConfig',function ...
1
vote
1answer
35 views

With $http.post in algularJS how can I pass more than one parameters

I am trying to do a post request to save data in the server using the following url: url = /api/projects/:projectId/scenarios/:scenarioId I want to pass projectId and scenarioId. How can I do that ...
0
votes
0answers
16 views

Angularjs Application Run

I am trying to prepare and get some information that will be used in the angularjs application I am working on, for example I want to get image paths or endpoints paths on the server. What I do is ...
0
votes
1answer
18 views

Dynamically bind URL params for $http service in AngularJS

How can I dynamically populate placeholders defined in URL string that is used for HTTP requests by AngularJS $http service? var urls = { GET_USER: '/api/v1/group/{groupId}/user/{userId}', ...
1
vote
1answer
56 views

Restangular api calls to external getting 'No Access Allowed'

Following Restangular's documentation and includes an example of this: // GET to http://www.google.com/ You set the URL in this case Restangular.allUrl('googlers', ...
0
votes
1answer
30 views

Advice on structuring and rendering different objects within the same view

I'm building an application and I'm looking for some advice on how to structure a specific piece of functionality I'm working on. I have this reports view, on this page a drop down with various ...
0
votes
2answers
65 views

How to use angularJS interceptor to only intercept specific http requests?

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) { ...
0
votes
1answer
45 views

Best way to pass data between a parent and popup page in angularjs

I have a page from where I click a button and a popup page opens. I need a way to pass json data from my parent page to popup. These two are separate angular applications. The data is then modified ...
0
votes
1answer
26 views

How to check for errors in resolve using angularjs?

Im using a resolve in ui-router and a promise in my controller, but cant figure out how to check if a 422 / 500 error is returned and show a different message. here is my code: .state('rated', { ...
1
vote
1answer
28 views

How to call a method when routing to a template in AngularJS?

How to call a method from a service when routing to a template in AngularJS? wikiApp.config(['$routeProvider', 'faqService', 'newsService', function($routeProvider, faqService, newsService) { ...
1
vote
1answer
22 views

Singleton configurable provider with access to cookie service

I've created a provider for signalR in our app. I need to be able to configure the connections once, and then append functions as needed. The code below works. Except for one part. (Which I've ...
0
votes
0answers
13 views

ng-resource: setting custom headers

I'm trying to set a Authorization header but it's not working. I tried both global and local header change var apiURL = 'http://0.0.0.0:8080'; var apiService = angular.module("apiService", ...
0
votes
0answers
19 views

AngularJS remembering page scroll location

I have multiple pages of data that lists publications by author. The first page lists all the publications and has infinity-scrolling implemented. Another page allows you to filter by author, and ...
0
votes
1answer
12 views

AngularJS: Factory and Provider Scenarios

I'm learning AngularJS and I noticed that A Factory is a short-hand for a Provider. Can you tell me specific scenarios where I should/must use a Provider instead of a Factory? The codes stays much ...
2
votes
3answers
50 views

AngularJS $resource only won't return data

So with a factory I'm making a RESTful GET request using $resource, and I'm not getting the data back. Initially, I get returned $promise and $resolved: false. $resolved eventually becomes true. I ...
0
votes
1answer
43 views

angularjs - Watching service properties in a controller scope… changing them from a directive… no update?

Let's say I have a very simple service with a few properties on it. If I use the service in a controller, put the service's properties on the scope so that they are bound to my view, and update them ...
0
votes
1answer
27 views

Scope is lost in AngularJS Service callback

I'm having problem with following code. I need to reference this.counter after a $timeout or callback from $http but it's undefined so please shad me a light here. var myApp = ...
-1
votes
1answer
41 views

How do you mock $rootScope in an angularjs service?

Given i have a service like this. angular.module('app') .factory('Session', function Session($rootScope, $cookieStore) { var user; if (user = $cookieStore.get('user')) { ...
1
vote
3answers
30 views

How to create a object with properties that are sharable among controllers in AngularJS?

This is a follow-up question to How to create this global constant to be shared among controllers in Angularjs? The answer provided allows a constant $webroot to be shared among controllers. app = ...
0
votes
2answers
41 views

How to create this global constant to be shared among controllers in Angularjs?

Suppose I want to make this a variable a constant to be shared among controllers in Angularjs; $webroot = "localhost/webroot/app" After some investigation, it seems services are the way to do. But ...
0
votes
2answers
56 views

AngularJs ngShow triggers double in controller

I have a problem with the controller triggering the method defined on the $scope twice when the page first loads and when the form submits. Here's the fiddle : http://jsfiddle.net/scabro/pQb6q/5/ ...
1
vote
0answers
137 views

AngularJS API call error with $http GET

I'm trying to create a simple app using Angular that will consume my API. I'm using a VM to run the code, and I access it on my computer, so to call the API from my machine I can use cURL or any other ...