Linked Questions
66 questions linked to/from AngularJS: How can I pass variables between controllers?
29
votes
4
answers
134k
views
How can I pass some data from one controller to another peer controller [duplicate]
I have the following two peer controllers. There's no parent to these:
<div data-ng-controller="Controller1">
</div>
<div data-ng-controller="Controller2">
The value of xxx is: ...
1
vote
1
answer
2k
views
AngularJS : Update Controller Scope from Another Controller/Scope [duplicate]
Hopefully this hasn't been asked.. I looked around and haven't found anything yet.
I have a single view that provides the user with a modal dialog (wizard) to create a few things and then save them. ...
-1
votes
1
answer
2k
views
AngularJS - Sharing variables between controllers [duplicate]
I know this has been posted before but I am still confused on how to achieve this for my specific problem.
my first controller:
myApp.controller("buttonCtrl", function($scope){
$scope.johnny = [...
0
votes
0
answers
614
views
Unknown provider: dataProvider [duplicate]
Im using the following code and the 'firebaseDetailCtrl' is throwing an error on page:
Error: [$injector:unpr] Unknown provider: dataProvider <- data <-
firebaseDetailCtrl
I'm not an expert,...
0
votes
3
answers
181
views
How can i pass variable values from one controller to another? [duplicate]
I have two different controller where i am trying to pass variable values to do some actions, I used $broadcast angularJS event but its not working. Is there any other solution to achieve this task ?
...
2
votes
1
answer
86
views
Can I use a controller in a page based on its controller ID? [duplicate]
I am using the same controller in several HTML pages in my project.
My problem is that each page links to the other and instead of them all using the same exact controller they duplicate it each time ...
44
votes
2
answers
41k
views
Using the same controller on different elements to refer to the same object
I figured if I slapped ng-controller="GeneralInfoCtrl" on multiple elements in my DOM they would share the same $scope (or least two-way binding isn't working).
The reason I want to do this is ...
21
votes
4
answers
21k
views
How to include one partial into other without creating a new scope?
I've this routes.
// index.html
<div ng-controller="mainCtrl">
<a href='#/one'>One</a>
<a href='#/two'>Two</a>
</div>
<div ng-view></div&...
29
votes
1
answer
44k
views
Better design for passing data to other ng-view's and persisting it across controllers
I started developing in AngularJS. I'm confused as to whether this is a proper design to pass data between my partial views.
Right now I have a loader page where I do some request.
function ...
35
votes
1
answer
48k
views
Where to put user defined functions in Angular JS?
In my view, I want to render:
<p>
{{ say() }}
</p>
Where say is defined as such:
say = function() {
return "Hello World";
}
I can define it in my controller:
function TestCtrl($...
14
votes
4
answers
46k
views
Retain page data on refreshing the page
I am new to angular. I am using a service which gets a list of objects and displays them on the 1st page. Then based on what object was clicked, I am setting the tab header on the next page. But while ...
8
votes
2
answers
11k
views
AngularJS, bind scope of a switch-case?
To get a grip on AngularJS I decided to play around with one of the examples, specifically, simply adding a "complete" screen to the Todo-example, when the user has entered 5 todos it uses a switch-...
5
votes
1
answer
11k
views
update variable in another controller in AngularJS
okay, so I am building a web-app using angular.js. I have started to implement user authentication.
I did this with it's own controller:
app.controller("userControl", ["$http", "share", function($...
5
votes
1
answer
8k
views
AngularJS pass data from controller to another controller
What I have done.
I retrieve a list of videos from youtube api with json in a controllerA with specific directive. The json contain the list of video and the video itself details.
What I want to do.
...
5
votes
2
answers
4k
views
Syncing data between controllers through a service
From this stackoverflow question, my understanding is that I should be using services to pass data between controllers.
However, as seen in my example JSFiddle, I am having trouble listening to ...