The AngularJS controller exposes the data that is to be displayed into the html view. It plays the essential role of the ModelView in the MVVM design pattern. The view is a part of the HTML template.
1
vote
1answer
19 views
Firing event from dynamically opened controller to parent controller in Angular js
I am developing an Web Application using Angular JS. Frankly, I am new to Angular JS. in my app I am using bootstrap.ui js for angular js. But I am having a problem with bootstrap modal controller. I ...
0
votes
2answers
23 views
use values to call factory's function in angular
Im trying to call the factory function from a controller using values but im getting a TypeError
Controllercode
$scope.onButtonHovered = function(event){
console.log("event.descriptorName "+ event....
0
votes
1answer
15 views
Pass Data to Service from Controller AFTER receiving info from Server
I need to pass data to an array in service after getting from server. The controller runs the function to retrieve data as shown
.controller("messagesController", function($scope, $stateParams, ...
0
votes
2answers
25 views
Cannot declare controller in Angular Js
I am developing an Web Application. In my application, I am using Angular JS. Frankly, I am new to Angular JS. But now I am having a problem my declaring controller. Please see my code below.
<...
5
votes
3answers
839 views
Angular - get parent directive's controller in child directive's controller (not link function)
I'm aware how I can get parent's directive controller in the child directive's link function.
However, I'd prefer to avoid using link function (and $scope all-together) and have all my code under the ...
3
votes
3answers
56 views
Difference between specifying objects on 'this' and returning the objects itself in a function [duplicate]
I'm a total newbie to javascript. Was just wondering what is the difference between the following when using the controllerAs approach, and why the second approach doesn't work:
angular.module("app")
...
1
vote
1answer
24 views
Picture won't display as part of my little angularjs app
I wrote a little app that converts Fahrenheit to Celsius and I want a picture to display based on the Fahrenheit temperature. I can't get the picture to display. Can someone tell me where I'm going ...
0
votes
1answer
28 views
Retrieving model values from dynamically opened controller's scope in Angular js
I am developing an Web Application using Angular JS. Frankly, I am newbie to Angular JS. Very new. In my app, I need to dynamically add and remove elements. I use directive for it. Adding and removing ...
0
votes
1answer
28 views
Calling a parent controller's function in the parent's context
I need my parent controller function getDataInParent to get called in the parent's controller's context itself.
Sample:
The child directive is correctly setup like this from within the parent ...
1
vote
2answers
27 views
updating variable in http request callback in angular
This is probably easy but nevertheless. I have a http call in my controller where I load a json file. I want to update a variable in my html based on a result. It updates apparently the variable (...
8
votes
4answers
12k 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
2answers
31 views
Controller data not passed to directive
I started looking into angular and cannot seem to figure out why my data is not passed to my directive. I have code here: https://plnkr.co/edit/ONwYevQ4NbvBVjTwARHl?p=preview
My Code:
app.js:
var ...
1
vote
2answers
21 views
Service undefined when injected into controller
I have a controller that I have injected a factory into but it comes back as undefined when I call a method on that factory. Not sure what I am doing wrong here. Any help would be appreciated.
...
70
votes
7answers
84k views
How do I inject a controller into another controller in AngularJS
I'm new to Angular and trying to figure out how to do things...
Using AngularJS, how can I inject a controller to be used within another controller?
I have the following snippet:
var app = angular....
0
votes
2answers
43 views
Angularjs - How can editable data be shared between run, factory and controller blocks?
tl;dr - app.run resets $rootScope.variable's value every time I invoke an API - I need help finding a way around that.
I have an AngularJS + ASP.NET Web API setup. I need AngularJS to send a token in ...
0
votes
2answers
760 views
How to initialize controller manually after app has bootstrapped?
I trying to add angular widgets into an existing non-angular app. The problem is that these widgets are not added by Angular, and are mostly injected into the DOM by a non-angular script.
The first ...
1
vote
1answer
49 views
Where should I place code to be used across components/controllers for an AngularJS app?
Should it be associated with the app module? Should it be a component or just a controller? Basically what I am trying to achieve is a common layout across all pages within which I can place or remove ...
12
votes
5answers
29k views
Calling directive's methods from parent controller in AngularJS
I am using AngularJS with the alias controllers pattern. I can't access (or I don't know how to) directive methods from a parent controller.
I have a function inside my controller that should call a ...
0
votes
2answers
423 views
Angularjs - Argument 'homeController' is not a function, got undefined
I have an ionic application that gives me below mentioned error when navigating `homeController's scope.
Here's my app.js file:
var app = angular.module('app', [
//external modules
'ionic',
//...
0
votes
0answers
18 views
How to set multipart mixed data returned from rest service to angular js controller object
I have to render json data and QR code image returned as byte array to angular js controller. I am getting the multipart/mixed result from rest service as follows:
"--uuid:10f48a0a-4ecb-43be-834f-...
2
votes
0answers
14 views
Passing data between angular controllers
Below is the sample code where I am trying to pass/sync the value between the two controllers. For the same in view I have a textbox and two place holders for showing the value of the textbox.
I ...
0
votes
1answer
29 views
Anguarjs Directive or Controller to seperate views components
I'm trying to learn Angularjs (1.5) I have already understood the concept of filters and services and I've also understood logic behind controllers and directives too. But when I started to write my ...
0
votes
0answers
23 views
Declaring angular controller inside visualforce component not working
I have several visualforce components with inline corresponding
angular controllers. Those are working fine if I'm loading them in
individual visualforce pages. But its throwing Error: [ng:areq]
...
0
votes
0answers
13 views
How do I create a filter that will limit my character count but not include the HTML markup as part of that character count?
Currently my code is:
<div ng-bind-html="job.description | limitTo : careerlist.limit">
</div>
but the issue I am running into is that job.description includes html markup which causes ...
0
votes
0answers
16 views
ReferenceError: FieldSetController is not defined (APEX)
I have a angularpubsub.js which has all the angular factory and services . I have another file controller.js
which has all angular controllers for individual visualforce components. But when I'm ...
0
votes
1answer
51 views
Defining angular controllers and component
I'm trying to call a function from within one angular component's controller to another component's controller. I found this answer, but the controllers are defined differently than what is shown in ...
1
vote
5answers
1k views
How can I have multiple controller files?
SOLVED
So after viewing your responses and making minor changes to my code, I found a simple typo which prevented me to reach the result I was after. So thank you all to helping with where I was ...
169
votes
7answers
57k views
Can an AngularJS controller inherit from another controller in the same module?
Within a module, a controller can inherit properties from an outside controller:
var app = angular.module('angularjs-starter', []);
var ParentCtrl = function ($scope, $location) {
};
app.controller(...
1
vote
1answer
31 views
reference form in angular component without scope
Currently I have this component definition:
var controller = ['$http', '$timeout', '$scope', function($http, $timeout, $scope) {
this.isInvalid = function() {
return $scope....
1
vote
0answers
19 views
Best way for a form controller to expose parsed data from the form it manages?
I come from a Java background and am getting up to speed on Angular 1.5.8+typescript.
I have a form controller that crunches the raw fields from a form and produces a data structure. An example of ...
0
votes
2answers
2k views
AngularJS : Use factory inside a controller
I use angularjs seed and trying to write a simple factory and insert it in to the controller.
I have a Row factory definition
angular.module('myApp')
.factory('Row', [ function () {
return 'some ...
0
votes
1answer
94 views
How to pass ngModel to AngularJS component without 2-way binding?
I have custom input as AngularJS 1.5 component with one-way data bindings and ngModel as two-way data binding:
return {
bindings: {
form: "<",
fieldName: "@",
minLength: "...
36
votes
3answers
10k views
Accessing inherited scope with Controller As approach
With the original way to define controllers, accessing the parent's scope was fairly trivial, since the child scope prototypically inherits from its parent.
app.controller("parentCtrl", function($...
2
votes
1answer
51 views
injecting a list into a json format
I'm new with angularJs and i want to inject a list of string that i get it using a restful web service into a jSON list.
And how can the connections list could proceed object returned by ...
0
votes
2answers
53 views
angularjs controller access directive scope value
I have this controller with directive inside my html code. The directive have scope value I would like access from the parent controller and show in the html. Hope my example code give you a simple ...
1
vote
3answers
43 views
Why is AngularJS Controller not working on my pc?
I have started learning MEAN Stack and wanted to try some code but AngularJs Controller is not working on my PC. I have windows 10 on my Acer Aspire V Nitro.
Can anyone please help. Will be highly ...
0
votes
0answers
98 views
Why isn't my AngularJS view updating?
(Update: still haven't solved this.)
(Further update: I've had no further responses from anyone. Surely this must be solvable?)
I'm combining Angular and D3, which I think is causing some problems. ...
3
votes
1answer
41 views
scope issue with ng-view, parent controller, custom directive
I'm so confused about my situation. Let me briefly introduce my situation.
HTML structure. (It's just structure, full HTML is more than that but there is no any other controller except "...
0
votes
2answers
31 views
AngularJS updating form with select and passing parameters into controller
I have a pretty simple itemController which contains an array of items (in actuality, these are obtained from an API). I want to then call the API again to get the subsections based on what is ...
4
votes
2answers
374 views
Using this instead of $scope inside controller
I am trying to follow style guide for angular and there wrote we should use this insted scope...
Styleguide
Could someone explain me when I am able to use this?
Here is my try..... What I am doing ...
0
votes
2answers
44 views
What exactly 'this' means in AngularJS controller?
index.html
<body ng-controller="StoreController as s">
<h1 ng-click="s.changeValFunc()">{{s.carname}}</h1>
<h2>{{s.carname}}</h2>
</body>
app.js
var app =...
1
vote
2answers
59 views
Controller not defined AngularJS
I get this error when I try to run my application.
Argument 'CampaignsSettingsController' is not a function, got undefined
My controller is defined here:
// Called Second
var ...
1
vote
1answer
220 views
Getting error when pass data between controllers using sample service
as part of angular js learning, i created small app that will pass the data between two controllers using services..below is my code to pass the data between two controllers..
Controller code
<!...
50
votes
19answers
85k views
Error: [ng:areq] from angular controller
This is a long shot, but has anyone seen this error before? I am trying to add 'Transporters' using express, angular and mongoDB. I get this error whenever I access a page ruled by the transporters ...
1
vote
3answers
107 views
Error: [ng:areq] Argument 'ControllerName' is not a function, got undefined
In app.js I have:
(function(){
var app = angular.module("myApp", []);
})();
in process.js which is included after app.js I have:
(function(){
app.controller('ProcessController', ['$http', ...
0
votes
2answers
32 views
Can a controller be in a seperate file when using ng-view?
Currently I am learning AngularJS. I have made a 'hello world' app that displays through the ng-view directive. So far so good!
My files are ordered in this fashion:
- WebContent *(root)*
> - ...
16
votes
2answers
22k views
AngularJS passing data to bootstrap modal
I think I'm missing something but cannot figure what.
Basically I'm trying to pass an object to the modal like below, but instead of getting the passed object I gets null...so I think is a problem ...
0
votes
1answer
62 views
Passing a directive to directive via an object in angularjs
Lets say there are 2 directive components
1) List
2) Profile
"List" should accept the data in the form of Object notation passed to it through the controller and display the HTML or Directive ...
3
votes
3answers
378 views
Did I share state correctly outside angular directive? (parent scope / $rootScope issue)
I have two elements on my page which are not nested in some way. With attributes on the first one, I would like to set the content of the second one, like so:
<body>
<input info="This is ...
23
votes
3answers
23k views
How to share the $scope variable of one controller with another in AngularJS?
I have this:
app.controller('foo1', function ($scope) {
$scope.bar = 'foo';
});
app.controller('foo2', function ($scope) {
// want to access the $scope of foo1 here, to access bar
});
How would ...