The angularjs-controller tag has no wiki summary.
1
vote
2answers
39 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
2answers
22 views
Broadcasting across AngularJS controllers?
How do I broadcast a message between controllers?
Here is what I have tried:
function Ctrl1($scope) {
$scope.$broadcast('Update');
}
Ctrl1.$inject = ['$scope'];
function Ctrl2($scope) {
...
0
votes
4answers
38 views
Unable to share data between AngularJS controllers?
I had seen the egghead.io video on sharing data between controllers, but couldn't get it to work:
var myApp = angular.module('myApp', []);
myApp.factory('QData', function () {
return 'hello'
});
...
0
votes
1answer
21 views
Angularjs two separate ui elements communicating
I have a use case to toggle the view of a form using a button. The button is not nested in the same structure of the form, and is out side the scope of the forms controller.
What is the best way to ...
0
votes
0answers
12 views
Submitting a form from an external controlller button for validation
If you look at my fiddle
I'm not sure why the internal 'Submit' button triggers browser validation (as per the required attribute) but the 'External Button' doesn't?
The external button calls the ...
0
votes
1answer
42 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 ...
0
votes
0answers
47 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
1answer
41 views
How to access the $ngModelController from inside the Controller without a Form and without a Directive
Maybe it's a rookie mistake, but I can't seem to access the $scope.model's $ngModelController so I can grab the $viewValue from it.
I have an input without a form (im using ui-mask directive):
...
0
votes
2answers
51 views
Load-time exception handling in AngularJS
I need to execute a function which is defined in controller in load-time, in order to gain json data from another place right after page is loaded.
I've tried to call the func immediately within ...
1
vote
1answer
62 views
AngularJS Controller $scope not displaying variable
I am new to AngularJs.
In app.js I have the following
angular.module('module1', ['module2'])
.config(function($routeProvider) {
$routeProvider
.when('/',
{
...
0
votes
0answers
44 views
Share data between controllers using permalinks?
I would like to share data between controllers using permalinks, rather than signals or factories.
Given a single page application, with three controllers (Ctrl1, Ctrl2, Ctrl3), and a predefined ...
0
votes
4answers
70 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
91 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 ...
1
vote
1answer
257 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', []);
...
2
votes
3answers
716 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
55 views
Checking for data uniqueness in AngularFire
Using AngularFire, I want to add an object to my angularFireCollection ONLY if the "name" is unique. My data is structured like so:
- ClientList
- dsk32923k <-Random unique ID created by ...
0
votes
1answer
354 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
39 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 ...
1
vote
1answer
55 views
What problems would I run into if I make all Data avalable 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
98 views
Angularjs: models binding
I have directive which dynamically creates input tags. I need to get values of created inputs on change event. Instead of it the name attribute on $scope argument in the controller is undefined. How ...
1
vote
2answers
377 views
Angular communication between controllers and directives
I have this piece of code which allows a user to leave comments on a list of items.
I created a directive and listen to keydown in order to let the user submit a comment if keyCode == 13.
Not sure ...
1
vote
2answers
118 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):
...
4
votes
1answer
111 views
angularjs: preventing route changes
I've tried doing the following in my controller:
$scope.$on("$routeChangeStart", function (event, next, current) {
if (!confirm('are you sure ?')) {
event.preventDefault(); ...
0
votes
1answer
55 views
how to make child angular controllers in a page depends on main controller of page
In my webpage there is main controller that needs some initialization to be done using services by calling data from server using $http or getJSON.
There are other child controllers in page that ...
1
vote
1answer
225 views
Using a child controller from another module
I've defined a module and made it the main module for my app using the ng-app directive. I added two controllers to the main app using angular.module('myApp').controller(). One of those controllers ...
0
votes
1answer
236 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 ...
1
vote
1answer
314 views
AngularJS The scope for dynamic content through $compile isn't attached to the controller scope
When I generate a new element through a string that has a directive (that's why I need to compile) and that directive generates an association with a variable in the controller scope through "=", the ...
-1
votes
1answer
289 views
AngularJS how to pass data from one controller to different directives [closed]
I am not sure whether I can do like this or there is a better way. I need someone to guide me.
I created two template using directive (both directives in the same page).
Let say
directiveVideo for ...
4
votes
2answers
2k 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 ...
2
votes
1answer
175 views
What's the correct way to trigger jQuery DOM Manipulation from within a controller?
So I keep reading that jQuery manipulation from within a Controller is bad practice, but I'm not clear on why, or how to correct.
Below is code from a Youtube tutorial which even the video creator ...
3
votes
1answer
484 views
AngularJS: Sending requests via $resource with array type parameters (checkboxes, multiselects etc.)
I have problems trying to use the $resource library in AngularJS to send a properly serialized GET request when there is an array of checkboxes (client_status) in my GET parameters.
This is the code ...
1
vote
2answers
371 views
How to reuse one controller for 2 different views?
I have defined one controller, and apply it to 2 views with small differences.
Angular code:
app.controller('MyCtrl', function($scope) {
$scope.canSave = false;
$scope.demo = {
files : ...
10
votes
4answers
9k 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 ...