Tagged Questions
0
votes
1answer
34 views
Would consolidating all my AngularJS model services into one be a design anti-pattern?
I asked this question earlier, which I'm still struggling with.
One possible solution I've come up with is to consolidate all of my models and the sync service into one service. Is this a bad idea? ...
0
votes
1answer
17 views
Force IE compatibility mode off in IE using tags for browser mode
I am using html5 with angularJs using follwoing tag
This results in Browser mode set to IE8 Compat, and Document mode set to IE8 Standards.
<!doctype html>
<html ...
0
votes
2answers
40 views
Sharing data between angularjs services without a circular dependency error?
I'm trying to build an angular application that will continue to function with an unreliable connection (i.e. mobile).
So far I have Services for each of my models (for example):
Classes
Students
...
0
votes
1answer
30 views
AngularJS: How to properly update data in a service?
There's no problem with populating a service (factory actually) with asynchronous data. However, what is the proper way of updating data in a service?
The problem that I run into is that all async ...
0
votes
1answer
34 views
angularjs unknown provider
There are a lot of unknown provider questions on stack overflow, and I've looked at a couple of them so far, but none of them solve my problem. If I find one that does, I'll remove this question.
...
1
vote
3answers
39 views
calling angularjs-service iteratively
I have an array of ids and would like to iterate over them and pass them to a service to fetch some data. But I would like to only move to the next id after the processing of the previous id has ...
0
votes
2answers
30 views
Injecting a service into another service in angularJS
Is it possible to inject one service into another service in angularJS?
0
votes
2answers
51 views
AngularJs: Controllers calls service method
I tried to create a method in the services.js :
var esServices= angular.module('esServices', []);
esServices.factory('boxItems', ['$http', function($http) {
................
...
1
vote
1answer
26 views
AngularJS - self referencing services?
I'm building an Angular app that will have a top-level Controller and a second-level controller. There will be n number of second-level controllers, but I want to put global-level functions someplace. ...
0
votes
2answers
28 views
AngularJS Services - using in Controller
I'm building a pretty simple app where I have a GlobalController (on body element), and will have another sub-controller below. This is a templated site with multiple, physical pages such that the ...
0
votes
1answer
33 views
angularjs use the same service as model with different data
I'm creating a factory service which provides me couple function like
var myApp = angular.module('panelServices', ['ngResource']);
myApp.factory('myService', [...]{
function myService(){
...
0
votes
0answers
31 views
clear all pending $http requests and reload page in angularjs
i tried $route.reload(); location.reload(true); $window.location.reload(true);but pending requests are not cancelling/aborting, page is reloading, how to hard reload page means closing all $http ...
0
votes
1answer
77 views
AngularJS Bind service array variable to controller scope
I have been able to properly bind an object with primitive data from a service to a scope variable from a controller but I'm having trouble doing the same thing with an array variable from the ...
0
votes
2answers
76 views
Error: [$injector:unpr] Unknown provider: in AngularJS Service Test
I am having a lot of trouble getting dependencies provided properly for an AngularJS service.
I see a number of other posts with similar errors here on StackOverflow but none of them seem to resolve ...
-1
votes
1answer
47 views
AngularJS not updating template variable when scope changes
This will be one of those stupid questions that is very obvious to the experts.
I have a websocket pushing data to a service where I'm trying to store the data and have it pushed to a template via my ...
0
votes
0answers
19 views
Q: Angular.js getting beyond simple data receiving $q- and $http-based factories
There's plenty of info how to get going with the $q and promises in general. But, it's quite hard to find any best practices on how to manipulate the data, after it got into client.
Suppose we have ...
1
vote
2answers
50 views
Data-binding from external HTTP API wrapped in a service does not work
I have a problem binding data from an external HTTP API. I tried to follow best practices and tried several approaches (reading the Internet and SO), but the "magic" of data-binding doesn't work and I ...
0
votes
0answers
30 views
Clear form after submit and disable form in angular service
I create a service to upload content.
it takes 4 argument
which folder to update
the content
set the form to disabled
clear form after submit
create: function(folderID, text, o, master) {
...
0
votes
0answers
40 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.
...
0
votes
1answer
60 views
Calling Service's method multiple times holds single data instance
I am using services for my AngularJS project and trying to call a service.method using a for loop, like this :
for( key in URLs) {
Service.fetchXML(key);
}
Service description:
[..]
fetchXML ...
2
votes
1answer
31 views
AngularJS unit testing services that are broken out to separate files
My services.js file was getting quite large so I decided it'd be best to split out the individual services into separate files (service1.js, service2.js, etc).
Unfortunately, this broke all my unit ...
1
vote
3answers
75 views
Flotcharts not rendering with angularjs
I am having issues rendering Flotcharts with data populated from an AngularJS (v1.2.5) service call. When the data is hard-coded, the charts render as expected but not when assigned the value from a ...
0
votes
2answers
52 views
How do you call a function from within the factory using a string in angularjs
I have some logic I would like to wrap up into an AngularJS factory so I can use angular's dependency injection. Since the logic is dynamic I don't necessarily know what is available to call ahead of ...
1
vote
1answer
65 views
how to call service method from ng-change of select in angularjs?
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" ...
0
votes
2answers
33 views
Injecting dependencies into AngularJS service
While reading through documentation on AngularJS services, I've stumbled across example services written like:
myApp.service('fooGetter', ['$http', function($http) {
this.getFoo = function() {
...
0
votes
1answer
34 views
Angularjs call synchronization
I am using angularjs get method to get array of feeds from server. here is my controller code.
$scope.feeds = new Array();
$scope.feeds = FeedService.getFeeds();
console.debug("in controller ...
1
vote
1answer
43 views
updating ng-model of one angular js controller from another angular js controller
Angular Experts,
I am new to Angular Js and trying to update input in one controller with value from the input in another controller. I am not sure whether it is even possible or not?
I have created ...
0
votes
1answer
44 views
AngularJS not binding promise to template
My service:
This was mistake 1 of 2 cause of my error:
getAll: function(url) {
deferred.resolve($http({ <--- deferred.resolve should not have been here
method: ...
2
votes
1answer
32 views
Storing generic controller function in services in order to get them in isolated scope
I have an Angular UI modal that I would like to use the following method on, I used to keep it on the controller that wraps my entire application(metaCtrl), but the modal seems to create his own ...
0
votes
0answers
26 views
Services naming in AngularJS
I have a lot of modules with lot of services.
Im trying to invent naming convention for my services, but not sure how to do it in the right way.
My idea is to name my services like ...
1
vote
1answer
38 views
cancelling angularjs timeout after route change not working
I'm have a timer that polls a server for data every 10 seconds. However, everytime a user switches to another controller, the timer should get destroyed. For some reason it's not happening with my ...
0
votes
1answer
38 views
AngularJS service injection incorrect/different when called from a $timeout or AJAX call
I have a directive with injected providers (with private variables) - sample code below and in http://jsfiddle.net/jycchoong/BmaQD/3/. The provider injected is as expected when (a) its method is ...
1
vote
2answers
82 views
AngularJS services independent of modules on multiple pages
I have a table of users in the database behind my angular app. I have separate login, registration, and user management views as separate pages.
I want to define a service that keeps a list of user ...
0
votes
1answer
238 views
angular js: splitting up a large controller into multiple files
I have a controller that is getting rather large.. mostly due to all the input validation I need to do. What I'd like to do is split out all the validation functions into a separate "partial ...
0
votes
0answers
42 views
Make sure some object is loaded from server before $locationChangeStart event handler gets executed
I have a handler bound to $location's $locationChangeStart event. Within that even handler, some user object coming from the server is required. Below is the code (simplified) that I have:
...
0
votes
1answer
53 views
AngularJS Model Logic
I would like some advice on how best to include logic within my model. Below is a simplified version of my model. I have some logic that should be included with start/pause/complete task before the ...
-1
votes
1answer
66 views
Not able to post data using $resource
I'm not able to figure out how to use $resource to POST data to create a new user. GET and DELETE are working fine though. I've spent a long time trying different ways given on the net, but still not ...
0
votes
1answer
17 views
Prevent from Angular scope variables to bind automatically to the service private members by reference
I have a private currJobs member that I use inside of a service, and use a getter and setter method to access it.
Additionally, if the user chooses to edit a specific job, I use a 'lookup' function, ...
4
votes
1answer
125 views
AngularJS - Deep object' property deletion
I know how to set object' "deep" property with $parse service , like in this post.
But how can i delete a deep property ? Not assign it to null with this:
...
1
vote
2answers
63 views
Combining resources in AngularJS
I have a RESTful API that provides me with employees and departments. In my AngularJS app, I need to know the employee and the departments the employee belongs to. I have defined two factory services ...
0
votes
2answers
57 views
How do I prevent angular-ui modal from closing?
I am using Angular UI $modal in my project
http://angular-ui.github.io/bootstrap/#/modal
I don't want user to close the modal by pressing on backdrop. I want a modal can only be closed by pressing ...
0
votes
1answer
46 views
AngularJS resourse structure for API
I have structure API:
api: {
users: {
details: {},
actions: {}
},
settings: {
users: {}
}
}
for example:
GET /api/users
return list of users
GET ...
1
vote
1answer
124 views
AngularJS $location.path(path) not updating at first
I have a piece of code where I call $location.path(name) and nothing seems to happens (at first). I can call console.log($location.path()) and it does show the new path -- but the view doesn't change.
...
0
votes
3answers
68 views
AngularJS Execute function after a Service request ends
I am using AngularJS Services in my application to retrieve data from the backend, and I would like to make a loading mask, so the loading mask will start just before sending the request. but how can ...
1
vote
2answers
281 views
How to mock $window.location.replace in AngularJS unit test?
I've got the following service:
angular.module("services")
.factory("whatever", function($window) {
return {
redirect: function() {
$window.location.replace("http://www.whatever.com");
...
1
vote
0answers
61 views
In Angular JS, can we use ng-controller twice? [closed]
I' am trying to develop an web application using Angular JS. I' am trying to create two Angular JS controllers in the same page but things seems to be not working. Please can someone tell me where I ...
1
vote
1answer
69 views
How to unit-test the interaction of an Angular Service with $cookies?
I currently have a service that is depending on a variable set in $cookies. However, when I want to unit test the interaction between the service and the value stored in $cookies, then the service is ...
1
vote
0answers
77 views
How to get JSON object (as 'GET') from url using $resource in angularjs
I'm an beginner in angularjs and don't have any idea about web services either. My requirement is something like this:
I have to get a JSON object from my url ...
0
votes
1answer
126 views
AngularJS, service which merges 2 resources
I am working with AngularJS framework (noobie), and I am trying to develop a service String which has to merge 2 resources. I mean merge the result (json) of 2 requests:
string/:stringId.json
...
0
votes
2answers
80 views
Angularjs, setting the value of a value service at runtime [closed]
I am new to Angularjs. I am working on my personal website and am using angular. I want people to be able to login. After logging in I want to store there username in a valueservice so that it is ...