Tagged Questions
0
votes
1answer
19 views
How share Service dynamic data between Controllers and Directives
I'd like to know what pattern to use, if I need my Service to share it's dynamic data between Controller, Directives, etc. The reason I mention dynamic, is because I'd like to load new data and this ...
0
votes
1answer
39 views
How to create reset() method in Service that return promise?
I've got a service called MyArticles. Using $http GET, collects all articles for a given Category. The MyArticles Service is injected in ControllerA, ControllerB, ControllerC, that should run some ...
-1
votes
2answers
42 views
AngularJS code in a
I am new to AngularJS and managed to get this to work. Can I get some feedback if this is done in an "Angular way?"
The DataResults Service just fetches some JSON data and will eventually have more ...
1
vote
2answers
25 views
Error in LInking service and directive in Angular
I have an issue at linking service having http to a directive. This is the code of that...
myapp.factory ( 'autoCompleteDataService', ['$http', function($http) {
return {
getSource: ...
0
votes
0answers
24 views
using cacheFactory in service for CRUD
I want to create a prototype for an application and I don't want to call rest services to retrieve data. For this, I want to create my objects in services (cache) and to use these services to display ...
0
votes
1answer
24 views
Angularjs promise with jquery ajax
The factory sends data to the server and its processed correctly but after that the ".then" in the controller is not being called below.
Kindly let me know why the "then" part is not being executed ...
0
votes
1answer
35 views
Binding an array of json results to html in angularjs
I'm pretty new to angularjs, and getting a json result set that I'd like to display. I have the following;
Service:
var Post = function(data) {
angular.extend(this, data);
}
Post.getAll = ...
2
votes
1answer
57 views
Angular directive not picking up service data
My service NavData
angular.module('navData', []).
factory('NavData', function() {
var navData = {};
navData.depth = 0;
navData.category_id = "";
...
0
votes
1answer
86 views
Unknown provider CookieStore
I am having service where I want to use the $cookieStore module. It works fine, but when unit testing it breaks, and gives the error: "$cookieStoreProvider <- $cookieStore <- filtersService".
...
1
vote
1answer
71 views
AngularJS: when to use service instead of factory
Please bear with me here. I know there are other answers such as:
Angular.js: service vs provider vs factory?
However I still can't figure out when you'd use service over factory.
From what I ...
4
votes
1answer
99 views
The better approach to design AngularJS services
I'm writing an AngularJS client application that would interact with a REST server.
To manage the client / server interaction I'm using the $resource abstraction.
Actually I'm writing every resource ...
1
vote
2answers
137 views
Firebase's AngularFire in an AngularJS service
The best way of handling Firebase in AngularJS surely has to be from within a service, so it's available to all Controllers across the App.
I just can't get it to work! ... I first tried using ...
0
votes
1answer
46 views
How to share data exclusively between a directive and a factory in AngularJS?
I want to build a modal directive with an Async API to open the modal.
What I was thinking about is a factory that returns me the API object that manipulates the modal directive. Using Angular-UI ...
0
votes
2answers
25 views
Loss of references between service and controller data in Angular.js
We encountered a problem when working with references between service and controller data
// We have a service that we use to store id and some other data
app.service('testService', function ($http, ...
1
vote
0answers
47 views
How to write services with $q and $http calls without being repetitive
I'm trying to figure out an elegant way to write AngularJS services without being so repetitive with the $q syntax.
Currently, I'm writing services like follows:
(function() {
function ...