Tagged Questions
83
votes
6answers
48k views
How can I pass variables between controllers in AngularJS?
I have two angular controllers:
function Ctrl1($scope) {
$scope.prop1 = "First";
}
function Ctrl2($scope) {
$scope.prop2 = "Second";
$scope.both = Ctrl1.prop1 + $scope.prop2; //This is ...
3
votes
2answers
4k 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 ...
1
vote
2answers
754 views
From an AngularJS controller, how do I resolve another controller function defined in the module?
Self explanatory fiddle: http://jsfiddle.net/5FG2n/6/
I need to dynamically choose the controller to use at runtime based on its name as a string. The string will be read from a config object.
In ...
6
votes
1answer
3k views
Sharing data between AngularJS controllers? [duplicate]
How do I store the items I've selected in a checkbox with other controllers?
My attempt (see the plnkr for views):
script.js (controllers)
var myApp = angular.module('myApp', []);
...
3
votes
3answers
3k views
AngularJs - Error: 10 $digest() iterations reached. Aborting
I am trying to create a Metro Tile type grid with Angular, to achieve this i want each of the tiles to be a different colour. So my plan of action was to create a function that would randomly pick a ...
0
votes
0answers
294 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
2k views
Reinitialize an Angular.js controller
if you have a controller to manipulate $scope variables in Angular.js, is there an idiomatic way to:
reset the controller's $scope, and
restart controller initialization?
For complex controllers ...
0
votes
1answer
42 views
Is there a way for a child controller to inherit a service “like” instance from its parent?
In my app I have window instances. The app can contain multiple windows and windows can contain multiple views. The views are children of each window instance.
function windowController($scope, ...
0
votes
1answer
255 views
Controller doesn't work after URL change
In short:
I have a controller that triggers some jQuery in my AngularJS web page to fade out a play button and a corresponding image. But, when the URL changes, the controller fails to work on ...