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.

learn more… | top users | synonyms

2
votes
0answers
24 views

AngularJS Help - User / Data driven UI Load data before finishing controller

So I have searched for multiple results online through StackOverflow and haven't really found the answer I am looking for. I am trying put together my main UI page with my AngularJS controller. What I ...
1
vote
2answers
1k views

How to update an angular directive with async data

I have a controller which gets json data called content.json. When I render the UI, I can't know if the json is available yet. The controller gets the json data asap when the app loads, it is an array ...
1
vote
1answer
41 views

AngularJS - Auto update data from one controller to an other

Ctrl 1 $scope.$watch(function () {return svc.getMessage();}, function (messageBody) { if(messageBody){ var eventName = data.eventName; var someCtrl = $rootScope.$new(); $...
2
votes
1answer
21 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
0answers
44 views

AngularJS $http.get print 2 times in console why?

I have one example with http-get for example: In my app: function Read() { return $http.get(server + '/user').then(handleSuccess, handleError('Error read user')); } In my controller ...
1
vote
2answers
59 views

Angular: How can I call a controller function from an HTML view using ng-if or another Angular directive

My question is; how can I call a controller function from my view when a condition is met/equates to true, using ng-if or perhaps some other Angular directive? Something like this: <div ng-if="...
0
votes
1answer
37 views

Hiding navbar based on current path with AngularJS ($scope vs. controller as syntax)

I'm working with the Inspinia Admin Theme (AngularJS Version) and have the following Problem. I'm trying to show or hide the navbar based on the current path. The Problem with my first approach (...
0
votes
0answers
21 views

Angular list rendering

I've recently started to use Angular for front-end development to communicate with an API to perform state changes in the UI. I would like to know what is the way to update a front-end component after ...
1
vote
2answers
47 views

Interpolation in Angular JS

I am trying to understand Interpolation concepts in Angular JS and I have written this code. I am trying to enter a text in input box and based on the template in text area tag it should replace the ...
0
votes
2answers
436 views

All AngularJS Controllers Not Loading with LazyLoad

I am trying to lazy load my controllers for my AngularJS app I built along side with requireJS. I have created a custom "lazyLoad" library that creates a resolve object in app.config() routes (also I ...
1
vote
0answers
15 views

AngularJs how to access attributes of objects with numbers in its name? [duplicate]

I have an issue to access object property that has numbers in it's name , below sample code is a response of Pinterest API , i can access each property except the images URL . error raised because of ...
1
vote
3answers
22 views

AngularJS multiple Scope needed for Autocomplete

I have an array structure like this. [ { "id": "1", "name": "John", "city": "NY" }, { "id": "2", "name": "Gerold", "city": "LA" }, { "id": "3", "name": "...
173
votes
7answers
61k 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
0answers
22 views

AngularJS - Children component binded value not refreshed in ng-repeat

I have a parent component "transactionList" which get a list of banking transactions from an API and a children component "transactionItem" repeated for each transaction in this list. I encountered ...
0
votes
3answers
24 views

angularjs 1 manual bootstrap doesnot work

I am new to angularjs. I tried to create 2 different modules in an single js file and them manually bootstrap one of them to a element. This was suggested in one of the stackoverflow questions. But ...
0
votes
2answers
212 views

Use controllers to: Manipulate DOM

I have a ng-repeat-end-watch directive ..... return { restrict: 'A', link: function (scope, element, attr) { if (scope.$last === true) { scope.$evalAsync(...
1
vote
1answer
24 views

AngularJs: Route Provider For Tab?

I am new to AngularJs. I am working in Angular Routing Concept. There are plenty of suggestion and examples are available for Routing and i am researching it. But its not fulfilling my requirement. I ...
0
votes
4answers
155 views

console.log for $scope in angular js

Why I'm not able to console output $scope values ? I'm trying to extract user assigned values from the pages and retrieve in controller. Eventually i would like to pass this to service so multiple ...
0
votes
3answers
32 views

AngularJs: How to initialize the value for function Which is returning NaN?

I had a problem on my code in angularJs function which is return NaN instead of 0 during initialization. Sample Code is Here var app = angular.module('myApp', []); app.controller('personCtrl', ...
0
votes
3answers
39 views

AngularJS, calculation addition (+) is not working

I tried to calculate $scope values through angular controller. For instance: the below code works in order to multiply values inside brackets. However, addition(+) is working like 400+200 = 400200. ...
1
vote
2answers
49 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-...
2
votes
1answer
30 views

After loading a new route old instances of controller is still running

I have a route which is loading a page based on the parameters: .when('/:num/:den', { templateUrl : 'app/views/templates/home.html', controller :"ProductContoller", controllerAs: "product", ...
0
votes
1answer
40 views

angularjs form validation shows success on page load with empty form

I have the following form, but some field are showing the success messages below the box on page load, without even touching the form. What is the problem? Here is the controller: app.controller('...
2
votes
2answers
35 views

AngularJs: How to call the angularjs function by Pressing tab button after entering text in the text box?

I am wondering how to call the angularjs function by Pressing tab button? var app = angular.module('myApp', []); app.controller('myCtrl', function($scope) { }); <script src="...
1
vote
2answers
55 views

AngularJs ng-repeat : how to bind the values from <input> which was inside the ng-repeat?

var app = angular.module('myApp', []); app.controller('myCtrl',function($scope){ //Adding New Check# and Check amount Text Boxes $scope.texs = [{id: 'tex', value: 'tex1'}]; ...
0
votes
2answers
674 views

Angular Typescript: Unable to inject $filter in controller

I am using a controller inside my directive. I have declared a function (change(searchAttribute: string)) in controller constructor which will internally use the filter but i am getting runtime ...
1
vote
0answers
25 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
44 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 ...
0
votes
1answer
40 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
16k 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
518 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
533 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
25k 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
26 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
14 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
52 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
19k 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
35 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
505 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
21 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 ...
170
votes
8answers
253k 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 = //...
9
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
74 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 ...
2
votes
1answer
941 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
20 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
20k 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
19 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
30 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
34 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 ...