Tagged Questions
0
votes
1answer
36 views
AngularJS controller scope won't sync with promise
I've picked up a project and I'm trying to return some data from a service to my controller. I've been at this for about 12 hours, and have tried different methods. They all usually result in this ...
0
votes
2answers
65 views
No data returned in consuming REStful web service using Angularjs
I am beginner learning Angularjs .Please help me with examples for following
script added
javascript -
var app = angular.module('myapp', []);
app.controller('MyCtrl1', ['$scope', ...
1
vote
1answer
42 views
Factory property is null when accessing directly from controller Angular
I'm trying to build simple loggin with angular and rest api and I've got strange problem with checking whether user is logged in login form controller.
Here is my code:
everytime I refresh my app it ...
1
vote
2answers
67 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
46 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
2answers
69 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/
...
0
votes
1answer
82 views
AngularJS Factory Service Controller $http.get
I am trying to retrieve the "cart" in the following way Factory->Service->Controller.
I am making an $http call but it is returning an object. If I debug I can see that the request is made and is ...
0
votes
1answer
129 views
AngularJS - mechanics of $scope.$watch - is it just an observer pattern?
I have some factory:
.factory("someFactory", function() {
var someFactory = {};
someFactory.objects = [
{ name: "obj1" },
{ name: "obj2" }
];
return someFactory;
}
And some ...
0
votes
1answer
101 views
Angular controller can't get data from service
Background: I'm learning AngularJS, I've written sample code to create a service for a module, and pass the data from service into one of the module's controller, all works fine.
But yesterday when I ...
1
vote
2answers
81 views
AngularJS cannot connect factory to controller
I'm sorry if this is an easy question. I'm new and probably don't understand the right things to search for to find the answer.
I've basically followed this angularJS tutorial ...
6
votes
0answers
2k views
Getting AngularJS Error: “[$rootScope:inprog] $digest already in progress” without a manual $apply
Other posts on this error always include someone trying to $apply without using a safe apply, but that's not the case in my example. My function IS successfully returning the data I requested from the ...
0
votes
0answers
213 views
excel file not getting after returning from Angularjs Service
I have situation where i have to call angularjs service method to post data to C# controller which in turns return me excel file which i want to save.
here is code....
HTML :
<div ...
1
vote
1answer
64 views
Service vs Inheritance for Access Parameters Outside `ng-view`
Is it more effective to use a Service or rely on Scope Inheritance when updating parameters outside an AngularJS ng-view?
I have an AngularJS page with an ng-view and a common header. When moving ...
0
votes
1answer
33 views
Can I give all controllers a new method that affect each controller's own scope?
In general terms
Can I make it so that all controllers have a watcher that exposes a local scope variable or a method that affects only local scope? Kind of like traits.
More specifically
Out of ...
0
votes
1answer
93 views
AngularJS remove $rootScope from a service
I have a service wrapped around WebSocket, I wanted to do it with promises and coupling requests with responses, here is what I came up with:
(function () {
var app = angular.module('mainModule');
...
1
vote
2answers
1k views
AngularJS: open a new browser window, yet still retain scope and controller, and services
I'm writing an angularJS app. In this particular controller, I open a new browser window through the $window.open service. But in the new window, all the $scope variables are lost.
I tried to use ...
2
votes
1answer
59 views
Getting just an object back from an asynchronous call
My goal is
to show a username, which needs to manipulated on a web page. The mnaipulation should be done centrally in a service (MasterDataService). I want to used a scope variable on the screen which ...
0
votes
1answer
67 views
Service functions outside Angularjs scope
I have created a service in angularJS that uses btford.socket-io module to interact with the server.
Since in the service I have implemented some API that I use inside angular at the moment, but for ...
0
votes
1answer
77 views
How do I properly set a service property from model data in a controller in angularjs?
I've set up a service to share some data/state between multiple controllers. In one controller, I update some of the service properties with scope data through a save function. That data is then used ...
0
votes
2answers
48 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
0answers
54 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
1answer
997 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 ...
1
vote
2answers
1k views
Initializing AngularJS service factory style
I have a service that retrieves data via REST. I want to store the resulting data in service level variable for use in multiple controllers. When I put all the REST logic directly into controllers ...
1
vote
1answer
534 views
Shared Variables between Controllers with a Service in AngularJS
I'm trying to share a group of variables between my controllers, but it does not seem to be working, I already followed some example but can't make it to work.
Below is the JavaScript
...
0
votes
1answer
345 views
angular JS service is null inside the controller
This is my first learning project for angular js.
i have created a controller(EditEventsController) and a service(eventData).
Code for the EditEventController is
'user strict'
...
3
votes
1answer
2k views
AngularJS Binding, multiple controllers through a service, part of page rendered from php
I know this is long, but it appears something specific in what I'm doing in the more complex scenario is causing the issue. All simple examples I attempt work fine.
I have an application setup using ...
0
votes
1answer
181 views
Search results filter - controller or service or filter?
I have a search results page. The search results page is basically one large controller at the moment. I have code which is for the filters however this isn't an angularjs filter as such because I'm ...
0
votes
1answer
193 views
where should i use the $http in angularjs? -> difference between factory and service
wher should i use the $http in angularjs?
in the controller or in the service?
i have already implement it in the service, but i want to execute not at the start of the app, i want to execute after ...
1
vote
0answers
391 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 ...
4
votes
1answer
2k 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 ...
1
vote
2answers
1k 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
0answers
390 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
4answers
1k 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
3answers
2k 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 ...
4
votes
3answers
8k 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 ...
0
votes
1answer
1k 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 ...
0
votes
1answer
71 views
Sharing a variable between controllers through a service
Here is my plunker:
From what I understand, since the Service Variable being shared is an object, the object that gets loaded to the service by controller 1 should be plainly seen by controller2 ...
2
votes
1answer
114 views
What problems would I run into if I make all Data available to all Controllers?
My AngularJS CRUD application processes it's information over a WebSocket Server. (This was mainly so that updates from one user would get automatically pushed to all users without the need for ...
1
vote
2answers
685 views
How would I re-instantiate an AngularJS controller after a change in data?
I have looked, and assume this is simple, but just couldn't figure out the API documentation for this.
Assume I have a controller that pulls data when first called (I'm leaving out a ton, of course):
...
0
votes
1answer
1k views
Angular: call service once multiple controllers
This should be a fairly straight forward question, but I'm stumped.
I have a service that makes an http call and then does extensive post-processing of the results. I would like the processed ...
37
votes
2answers
14k views
AngularJS - The correct way of binding to a service properties
I’m looking for the best practice of how to bind to a service property in AngularJS.
I have worked through multiple examples to understand how to bind to properties in a service that is created using ...