0
votes
0answers
13 views

Extend rootScope with alert service?

I can easily envision myself injecting my alert service into almost every one of my controllers: myApp.factory('AlertsList', function () { return [{ type: 'info', msg: 'Welcome!'}, ...
0
votes
2answers
44 views

Propagating change of data in service to controller

I have a service for storing some application common data. This service can also modify this data and react to events. However I am having trouble with propagating the changes to controllers that are ...
0
votes
1answer
23 views

AngularJS: Authentication Service supporting a promise?

I have setup an authentication service which I inject into my Login controller I then call it to do a login... for example $scope.login = function() { var loginResult = ...
0
votes
1answer
31 views

AngularJS - How do I avoid using $timeout to wait for an element to be created?

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 but ...
0
votes
0answers
35 views

Uncaught TypeError: Cannot read property 'parentNode' of undefined - AngularJS and jsPlumb connect

So I am trying to connect two elements that are created using angularjs by the user, with a curved line and I am getting this error: Uncaught TypeError: Cannot read property 'parentNode' of ...
0
votes
2answers
28 views

Angularjs - Declaring factory with a single object with a nested array - getting ReferenceError: … is not defined

I have a factory with several different methods and I am trying to declare an object that has an array nested in it. That one nested array will be the main driving force for my app and it will have ...
0
votes
1answer
27 views

AngularJS service: gets error has no method 'save'

I'm using AngularJS v1.0.7 and here's how I setup the service: angular.module('myAngularJSApp.services',['ngResource']) .factory('RegisterNumber', ['$resource', function($resource) { ...
0
votes
2answers
28 views

Issues with controller in an ng-repeat communicating data to a different controller, depending on which ng-repeat element was clicked

I am trying to do the following: I have two controllers that communicate to each other via a service ( Here is my jsFiddle: http://jsfiddle.net/GeorgiAngelov/a9WLr/1/). The idea: The idea is that ...
0
votes
1answer
81 views

Parsing $ from JSON resp in AngularJS?

How do I parse in $ from JSON HTTP responses in AngularJS? Trying to grab YouTube search results without JQuery: ...
0
votes
1answer
71 views

AngularJS - ng-click does not remove previous click's modifications when clicked again

So I am trying to acomplish this example: http://jsfiddle.net/pkozlowski_opensource/WXJ3p/15/ However, for some reason, when I click on one div, and then on another, it does not remove the "active" ...
8
votes
3answers
86 views

Should services expose their asynchronicity?

I'm writing a service that will retrieve data asynchronously ($http or $resource). I can hide the fact that it is asynchronous by returning an array that will initially be empty, but that will ...
0
votes
2answers
36 views

AngularJS: Manually Registering a Service

I have a page with multiple widgets. After the page loads I get a list of widgets which containes a url. I then ng-include the url. Each widget has it's own controller, which is loaded using a ...
1
vote
1answer
97 views

How to do an HTTP Options request in AngularJS?

AngularJS' $http service doesn't provide for HTTP Options requests, and I very much would like to have them. I created a Web API using Django REST framework and I'm trying to leverage all it offers ...
1
vote
2answers
69 views

ng-repeat not updating using $scope.$watch

I need some help in displaying the results of an update in my ng-repeat directive from $watch ProductsCtrl is watching for a change of product type and when it detects one it searches for Products ...
0
votes
1answer
38 views

Using angularjs service ($cookies) in factory registered using couchpotato

I'm using angularjs with couchpotato for help with lazy loading. My question is how do I reference angularjs services like $http, $cookies in my service registered using couchpotato? The normal ...
6
votes
2answers
59 views

Call angularjs service from simple js code

I have the following angularjs service: angular.module('app.main').factory('MyService', ["$http", function ($http) { return new function () { this.GetName = function () { ...
0
votes
0answers
74 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
2answers
197 views

Angularjs: Passing along a token using $resource?

I am trying to pass along a token using headers with my $resource requests. Normally you can do the following $http.defaults.headers.common in the .config, but I am unaware of these when the ...
5
votes
1answer
61 views

AngularJS philosophy - controllers as “windows” to services

Sorry for the vague title; I've been restructuring some of my AngularJS code, trying to be more "Angular" about it, and I've noticed this pattern popping up quite a bit: app.service("someService", ...
0
votes
1answer
28 views

Recycling AngularJS functions

I am pretty new with AngularJS, but was wondering how to create commonly used functions outside the scope of a controller. For example, I pretty often need to call a function to start a "Loading" ...
0
votes
2answers
50 views

Passing service between controllers and directives

I have a single service defined as follows: angular.module('myApp') .factory('myService', function ($resource, $q) { mySource = []; EndPoint = $resource('/my/api/endpoint', ...
0
votes
0answers
64 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. ...
1
vote
1answer
89 views

Stop $timeout when starting new controller

I'm polling for my data every 2 seconds to keep them updated on the page. My problem is when I visit an other page the timeout stays active. How can i cancel my timeout when I visit an other page? ...
0
votes
1answer
79 views

Testing a AngularJS services with dependencies

I have som issues testing a simple service in AngularJS, which depends on another service. The service looks a bit like this: serviceModule.factory('filtersService', ['$rootScope', 'urlService', ...
0
votes
1answer
109 views

Require factory method when called by controller

I'm using an angularJS and requireJS seed which you can download here: LINK In that seed only the controllers that are called download the relevant controller which is then triggered. I've been ...
0
votes
1answer
83 views

Modifying a Shared Variable Between Multiple AngularJS Directives

I have created this jsfiddle: http://jsfiddle.net/noahgoodrich/CDwfL/1/ I have created a set of directives to manage and manipulate navigational tabs. For some reason, when I try to close a tab, it ...
0
votes
1answer
109 views

Angularjs async callback return undefined under $scope.$apply();

This is my factory code. The callback is async so i put it under $rootScope.safeApply(). Then I call console.log(authService.authUser) in my controller but it still return undefined when user logged ...
0
votes
2answers
250 views

AngularJS: How to pass values from Controller to Service Method?

I have a controller which is dependent on a TransactionService. One of the method is $scope.thisMonthTransactions = function () { $scope.resetTransactions(); var today = new Date(); ...
3
votes
1answer
99 views

Single page app, permalinks and ngView?

This is my current setup, with each column being represented by a controller: <navbar></navbar> [column1] [column2] [column3] <footer></footer> Additionally each column has ...
0
votes
4answers
103 views

Cannot get simple push/splicing of array to work - AngularJS

Please have a look at the following Plunker project. I want to keep a list of items in a service which multiple controllers can access. In this example when you select a surname it will come up in ...
0
votes
1answer
37 views

How do I make real POST requests in an E2E beforeEach() function?

I like to perform E2E testing using a real http backend. As part of my E2E testing I want to create a test user in a beforeEach() function, and I would remove this user in an afterEach() function ...
0
votes
3answers
123 views

$watch not working on variable from other controller?

I have one controller which displays a checklist, and stores the selection in an array. My other controller runs an $http.get on the array from the first controller. How do I set a $watch so that ...
0
votes
1answer
64 views

Understanding $watch in AngularJS? [duplicate]

I am a little confused with the $watch syntax in AngularJS. Given a variable $scope.foo, with initial value of [1,2,3], and update causes it to now equal [1,2]. I want a function to be run whenever ...
2
votes
3answers
1k views

Simple Angular $routeProvider resolve test. What is wrong with this code?

I have created a simple Angular JS $routeProvider resolve test application. It gives the following error: Error: Unknown provider: dataProvider <- data I would appreciate it if someone could ...
1
vote
2answers
178 views

AngularJS: Using services in directives

This is an angularjs app. I have a service that handles the loading of content (ajax). While the service is getting the content, a number of things throughout the app hide, later showing again ...
2
votes
1answer
34 views

Problems trying to define and configure my custom provider

I am pretty certain I'm following all the rules: $get() is defined. injecting properly into the controller configuring in the initial app def before it's instantiated Here is a fiddle ...
0
votes
1answer
57 views

AngularJS deferred specific behavior inside the scope

Assume that we have a bit of html like that: <button id="my-login-button" ng-hide="loggedIn" ng-click="login()">Log me in!</button> Also we have a JavaScript: // controller.js ...
0
votes
1answer
504 views

Angular JS delay controller and directive initialization until data is returned from server

My AngularJS app requires some metadata from the server before it can initialize the controller and a handful of directives. I have a service to return the data but have been unable to get the ...
1
vote
1answer
194 views

Inject AngularJS service into global scope

Is it possible to get an angular js service into the global scope to use in the JS Debugging console? What I'm going for is some very low tech, quick and dirty, testing. Something like: var myService ...
0
votes
0answers
71 views

How to reuse an angularjs service when the server db path is hardcoded?

If you look at the Wire up a Backend Server Communication example on angularjs.org the mongolab module seems reusable except for the hardcoded $resource path and key: angular.module('mongolab', ...
0
votes
0answers
71 views

How to get $resource key to pass to a view in AngularJS?

I need to get the resource key from an array of resources in my AngularJS SPA. I use a resource like this: var answers = $resource('/api/answers/:id', {id: '@id'}) It connects to my node.js backend ...
5
votes
1answer
140 views

How can I extend $q promise in Angularjs with a .succes and .error

I wrote this little code in a custom service in AngularJS. In my service : var deferred = $q.defer(); var promise = deferred.promise; deferred.resolve('success'); ...
1
vote
1answer
62 views

binding data to angularjs from external model

I've got directive and service in my app (declared in separate files): Service: (function(){ angular.module('core', []) .factory('api', function() { return { ...
1
vote
2answers
170 views

angularjs with firebase auth share service

Halo all, I want to use angularjs with firebase simple login (facebook). But I have no idea how to create the auth share service. What I want to do is create a authentication service use this ...
1
vote
2answers
363 views

AngularJS: PUT send data with URL but not as JSON data

Here is my UserService angular.module('userServices', ['ngResource']).factory('User', function($resource) { return $resource('/users/:userId', // todo: default user for now, change it ...
0
votes
0answers
44 views

how to work eith services in angularjs using requirejs?

Here I am getting this error : Uncaught Error: Provider commonService must define $get factory method. from mansonscms What does it mean ? I want to include multiple services with requirejs.. But it ...
0
votes
0answers
88 views

AngularJS - Multiple resolves from service / service progress indication

I am looking for a solution to get some sort of state progress indication from a service. I realize now that there is no way to resolve a promise more than once but I am looking for an alternate ...
0
votes
2answers
62 views

How to get data from service - data that will be fetched with a delay

I have the following service declared: app.factory('data', ['$http', function ($http) { var dataRecords = {}; //Retrieve the entries from the data file and categorize them according ...
0
votes
1answer
123 views

Proper way to set up angularjs factory with cached data

I'm just starting out with Angular.js and I'm trying to figure out how to set up a factory that will show cached data and replace it with data retrieved from a REST service once it is received. To ...
2
votes
1answer
101 views

How can I register an angularjs factory after the app has “started” / been loaded?

I've got the guts of a routing architecture in Angular that will dynamically download and inject Angular Controllers and Services ... the Controller part works fine, and I'm trying to download ...

1 2 3
15 30 50 per page