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
0answers
22 views
Getting controller reference in service with $controller
I am new to Angular, but I am working on a service class that I have need to get a reference to a Controller by name.
This particular service is used in the navigation, and setups a listener on $...
0
votes
3answers
23 views
How to add a progress bar in ionic app
I really need your help, I am new to ionic project. Currently working on a project. This app pulls blog post from wordpress using $http. How can I add a progress bar to tell the users that the page is ...
1
vote
2answers
43 views
How to manipulate the <title> of an AngularJS single page app?
I have a single-page AngularJS app.
The index.html file looks like this:
<html ng-app="myApp" ng-controller="MyCtrl as myctrl">
<head>
<link rel="stylesheet" href="my-style-...
0
votes
1answer
36 views
AngularJS Controllers
Recently faced angularjs controller behaviour. Someone accidently from team did structured DOM like this : -
<div ng-controller="firstController">
<div ng-controller="secondController">
...
9
votes
3answers
15k views
Load controller dynamically based on route group
Is it possible to load a controller, it's js file, and a template dynamically based on a route group? Psuedo code which doesn't work:
$routeProvider.when('/:plugin', function(plugin) {
templateUrl: ...
1
vote
2answers
417 views
Angular - reusing code (service or controller)
I'm using Angular to develop commenting functionality for a web app.
Currently there are two sections in the application were a user can comment:
Category
Product
About 90% of the commenting ...
0
votes
2answers
461 views
How to run a directive after the dom finished rendering in Angularjs
I'm try to render the template dynamiclly, How to run the directive after {{tag}} has been rendered finished ?
directive:
angular.module('services', [])
.directive('demo', function() {
...
16
votes
8answers
23k views
AngularJS ng-controller not working
I just now started learning on AngularJS from w3schools. I am trying to practice examples what ever they have mentioned in the tutorials. Every thing works fine but when i came to "AngularJS ...
1
vote
1answer
23 views
AngularJS isolate directive - data not binding in .controller (but works in .link)
A custom directive was created in AngulerJS 1. It has in isolate scope, and is data-aware (gets data from server API). Its definition looks like this:
var dirJobView = function ($location, ...
0
votes
1answer
10 views
Angular injector error with Filestack
I am attempting to integrate Filestack into an existing app. I think I am having issues with how those modules are configured, but can't get the ordering correct. I receive this error:
angular.js:...
0
votes
1answer
23 views
use jQuery.matchHeight from Angular directive
I am trying to set elements to the same height using jQuery.matchHeight. I call the function from an Angular directive
angular.module('myApp')
.directive('matchHeight', ['$timeout', function ($...
10
votes
3answers
16k views
Angularjs Uncaught Error: [$injector:modulerr]
I am learning Angular.js and I am not able to figure out whats wrong with this simple code. It seems to look fine but giving me following error.
**Error**: Uncaught Error: [$injector:modulerr] http://...
0
votes
2answers
26 views
Does controllerAs work with Isolated Scope?
I'm familiar with using controllerAs, but do not understand why, when using with isolated scope, none of my controller properties are showing up on the scope.
Here's a plunker showing what I'm ...
0
votes
1answer
34 views
Load image using AngularJs
I have create a simple web site using angularjs and bootstrap.
In one page, I load a static image and I set some botton on this using bootbox.
When I run in local my site using
grunt serve
I see ...
1
vote
3answers
468 views
How to get AngularJS to fill initial tag value in svg template?
I'm trying to get an AngularJS directive to set various properties in an svg tag.
angular.module("complexNumbers")
.directive("cartesianPlane", function() {
return {
restrict: "E",
...
0
votes
1answer
20 views
Pass Array from Controller to Factory error
I have a factory thats using angular-websocket to connect with a backend and I need to pass info from my controller to it so that it would send that info and I want to pass it as an array.
Factory is ...
164
votes
8answers
243k views
How do I use $rootScope in Angular to store variables?
How do I use $rootScope to store variables in a controller I want to later access in another controller? For example:
angular.module('myApp').controller('myCtrl', function($scope) {
var a = //...
8
votes
2answers
6k 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 .....
0
votes
0answers
41 views
Sharing data between controllers using $broadcast
To share data between controllers it is common to use service.
I found that using $rootScope.$broadcast is really convenient if the data I have to share is a [] or an {}.
For me the advantage of ...
1
vote
1answer
856 views
Same “controller as” name in angular js directive breaks function in parent controller
I've a controller with some items for ng-repeat and each item should get a random color so I use ng-style with a function in that controller called randColor(...).
app.controller('TestController', ...
0
votes
1answer
19 views
Passing Data from Service to Template via Controller and $stateParams
I have a service with the following code:
.service('ChatService', function() {
return { //Gets Data from controller
sendData: function(data) {
this.chatData = data;
console.log('...
6
votes
1answer
19k views
Angularjs click and display from a list
I want to create a simple list and when the user clicks on a button the value is displayed in a span element.
HTML & Controller
<html xmlns:ng="http://angularjs.org">
<script src="http:/...
0
votes
1answer
18 views
Trouble accesing JSON file with angular
This is the JSON and controllers im using:
JSON Format:
{"tomcatLogDir":"C:\\apache-tomcat-7.0.70\\logs","tomcatLogs":["1.log","2.log","3.log"]}
Factory:
app.factory('filesFactory', [ '$http',
...
0
votes
3answers
28 views
Unable to get controller loaded into my angularjs module
I'm trying to split my angularjs controllers into files but failing everytime.
Directory Structure:
--public--
--js/controller/resturant.js
--js/master.js
--index.php
Code ...
1
vote
1answer
22 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
24 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
20 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
27 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
938 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
65 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
25 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
35 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
29 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
28 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
13k 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
35 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
25 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.
...
74
votes
7answers
90k 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
45 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
786 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
65 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 ...
14
votes
5answers
31k 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
532 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
21 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
17 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
32 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
32 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
18 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
61 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 ...