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

1
vote
2answers
29 views

AngularJS Communication between ng-repeat and controller

I've just started using AngularJS, and as a project I decided to build a simple app for managing bookmarks. I want to be able to maintain a list of bookmarks and add/remove items. I'm using Django ...
0
votes
1answer
28 views

Karma testing: TypeError: Attempted to assign to readonly property

When I am trying to unit test my controller I am getting the error.When I debug the testcase's expect I am getting the expected value but its failing with below error.What am I missing here or whether ...
0
votes
1answer
46 views

$scope data is not updating in view for the first time

controller.js $scope.getElectInfo=function(){ var selectedVal = $("#countriesList option:selected").val(); if (selectedVal != 0) { $.get(APP_URL+ ...
0
votes
1answer
23 views

AddDevicemodalCtrl is not a function, got undefined

I am getting the error noted above, I believe this is because the controller is not attached to the module properly, however I could be wrong. Here is the controller that has been defined. (function ...
0
votes
1answer
49 views

index.html page not loading in controller

in app.js $routeProvider.when('/', { templateUrl : appUrl + '/index.html', controller : 'HomePageController' }); in controller.js ...
0
votes
3answers
44 views

call function in controller from template.html

I am new to AngularJS, Somehow while going through many sites now I am able to create a directive for showing some data.Now I need to send some data to controller by clicking the button. I need to ...
-1
votes
2answers
26 views

Setting the value of ng-click directive based on the variable assigned to it

I'm using angularJS to make a SAP. The problem I am having is within one of my template files. I want to set the value of ng-click directive using a variable declared in that controller. Based on the ...
0
votes
1answer
26 views

using $http in component module angular JS

I'd like to understand why i can't retrieve data from external sources. I need to recover the content of a Json and parse it to display content in this template : Nombre of news: {{new.length}} ...
1
vote
1answer
34 views

Custom validation as a function in Angular

In Angular, I am trying to validate a value of a field on blur. I have a list of customers, and I want to check if the model value in the field is in my list of customers. If not, I want to set the ...
0
votes
1answer
29 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) { ...
2
votes
1answer
39 views

How do call function with parameters from controller into view and how to bind that function to directive in angularjs

The problem is stated in the title. I have the following code. JavaScript: app.controller("myCtrl", function($scope) { //this is my controller $scope.type = "type"; ...
0
votes
2answers
32 views

Angular, controller without a module, unable to decipher the error

See the image for the problem angular.controller('myController', function ($scope) { var reg = { firstName: 'Aaa', lastName: 'Sss', }; $scope.reg = reg; }); This is my ...
0
votes
2answers
44 views

How to put multiple HighChart in a page having different series value in different chart

app.controller("myCtrl", function($scope) { $scope.perspectives = [{ title : 'Depression Remission at 12 Months CMS159v4', graphData: [34,2,5,5,2,1,10] }, { title : ...
1
vote
3answers
20 views

Trouble with Controllers to manipulate an Object inside a Service

I have an object which should be accessible in many controllers. This object is inside a Service, has default values and the controller might change those values later. My problem is that my ...
1
vote
3answers
58 views

Show a div with AngularJS

I am searching how to show a div with AngularJS. I read some topic on StackOverflow but when I try to apply them, it doesn't works for my case... This is my HTML code : <div id="myPanel" ...
0
votes
1answer
19 views

How to keep different files for controller and directive which is using that controller

I want to understand if there is any way that I can keep controller and directive which is using this controller in different files? I have two files, say 1. MyController.js and 2. MyDirective.js. ...
0
votes
2answers
31 views

Is this the correct way of binding factory to controller?

I have the following code in my module: .controller('ModalInstanceCtrl', function($rootScope, $scope, emailService) { $scope.emailService = emailService; // Good or not; if not, why? ...
1
vote
4answers
34 views

angularjs app not working after code concatination

I have and angularjs app.I want to concatenate all the JS files to a single file.I'm currently trying to use Grunt.js to setup an automatic build process for concatenating JavaScript files. However ...
1
vote
1answer
25 views

Angular $watch not working on controller variable updated by directive

I am trying to place a watch on controller variable which gets updated from a directive using function mapping. variable is getting updated and logged in console but watch on it not working. Code ...
0
votes
1answer
48 views

angularjs - load different controllers/js files based on users' access levels

I'm working on a web app where users have different access levels. Each access level has different sets of controllers/views. I'm using ngRoute and ng-view. Each controller has its own JS file and it ...
2
votes
1answer
38 views

Using Browserify with Angular JS - - Passing a service into a Controller

As the title suggests I've recently started a new project where I'm using Browserify (and Gulp) to concatenate my Angular JS files (and the Angular sourcefile) into a single file - bundle.js. I've ...
2
votes
1answer
53 views

why angularjs controller loading twice

Here is my route config, I am using routeProvider to bind controller to view and not declaring ng-controller in my view still my controller loading twice, I searched for lot of solutions and tried ...
1
vote
3answers
32 views

Angular js controller design passing data of http post response to another controller

I am new to Angularjs. I have a question on the design of controllers and sharing of data. I have the first partial upload.html which uses UploadCntrl for uploading a word document to the server ...
0
votes
2answers
54 views

directive isolate scope data undefined in controller

I have been writing down a module for image gallery, I have got a issue with it, my isolate scope is becoming undefined and does not change its state. I cannot understand the reason for it. I have ...
0
votes
0answers
21 views

Execute controller asynchronously

I have a controller within another controller in the HTML file. I want to execute both controllers asynchronously as both are not dependent on each other but the HTML structure is like that. ...
1
vote
4answers
43 views

Angular JS: unable to display value

I am a new learner of Angular JS. Please help me to find reason why this demo only display : {{name}} instead of showing each values, <!DOCTYPE html> <html> <head> ...
1
vote
2answers
58 views

Unable to fetch data from controller in multiple html page in angularjs

I am trying to make a webpage.In that when a user login , a new html page("dashboard.html")opens in the view. This "dashboard.html" contains some links(links to other html pages).When user clicks on ...
1
vote
1answer
32 views

Angular directive binding without template controllerAs

I'm encoutering an issue when using a custom directive without template (use Server generated DOM) and binding my view to a controller. Here is my jsFiddle sample : angular.module('myModule', ...
2
votes
3answers
55 views

Inserting text into HTML from AngularJS

In my index.html file, I have created a very bare-bones form. I have separated much of the detail into app.js so that if someone wants to have their version of the form look different, they just have ...
1
vote
1answer
32 views

AngularJS Expression not displaying the data from service

I suspect it is an incorrectly written expression or the way the controller is fetching data from the service. By the way, the controller has been tested and it works just fine. Please help. Here ...
0
votes
1answer
21 views

$location.search() used with external function reset whole $scope. How to avoid it?

Example of problem: Plunker Its about controller.js file. I am trying to pass cleanSearchParameters output into $location.search function and it does work, but after whole $scope gets reset. Check ...
0
votes
1answer
22 views

$location.search() - how to use params from scope inside $scope.$watch function?

I need to pass function variable into $scope and reuse it inside $scope.$watch. I don't know why my whole $scope get resetting all the time in first example. Living example of my problem: Plunker ...
0
votes
1answer
64 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 ...
0
votes
0answers
24 views

angularjs - test a directive controller

I'm trying to test a directive controller. Here's the directive code: angular.module('bars', []).directive('timerBars', function() { return { restrict: 'E', scope: { timer: '=', ...
0
votes
1answer
58 views

ng-model not working with radio buttons in angular

I have a simple form with radio buttons that pulls values from a server and loops through them to provide radio buttons: <form ng-submit="createSubCategory(subcategory)"> <div ...
6
votes
2answers
131 views

AngularUI Datepicker disable dates outside of range

I want to limit the Angular UI Datepicker to be between two dates passed in as variables. Preferably I'd like to get it working without adding a library like momentjs, because this is the only field ...
1
vote
1answer
46 views

angularjs show hide based on file extension of file input

Anyone know how to check a file extension on a file input and display a div based on the file type. I need to give different upload option based on the file being uploaded. It text asks for an input ...
1
vote
2answers
40 views

AngularJS: display a block of html after button click

I am trying to write a controller to handle the button click of the "New" button. The goal is for the lower block of code (starting <div ng-show="buttonClick">) to be initially hidden. When ...
0
votes
3answers
65 views

TypeError: $controller is not a function + Controller inside controller

I am new to Angular JS and trying to call a controller inside another controller but getting below error. ionic.bundle.js:21157 TypeError: $controller is not a function at new <anonymous> ...
0
votes
0answers
28 views

Why doesn't this angular code / directive seem to be executing?

None of the links are broken. None of the Javascript between the two console.log's seem to be executing. I've been trying to work this out for a while but don't see anything wrong. Any clue ...
1
vote
2answers
77 views

AngularJS controller doesn't work after first refresh page

I'm using AngularJS for my hybrid Ionic app. My controller: .controller('SubmitCtrl', function($scope) { console.log("this just work for only refreshing the page!); }); Only for each refreshing ...
0
votes
1answer
25 views

$http POST request response returning a JSON object in service, but when called in the Controller it is undefined

So pretty much I have a service that contains functions for making some REST method calls via the $http service in AngularJS. These methods are then being accessed and called in the Controller. ...
2
votes
0answers
39 views

AngularJS Cordova app sometimes cannot find controller

I have this weird error in a Cordova/AngularJS app. Sometimes (rarely) AngularJS cannot find the controller and chrashes, leaving users with a half-loaded unresponsive view. The error only seems to ...
0
votes
2answers
58 views

How do I call a controller method from my directive?

How do I call a controller method onDrag() from my directive? Html / (SVG) <g ng-controller="EntityController as vm" draggable> ... </g> Directive app.directive('draggable', ...
1
vote
2answers
38 views

Issue with angular factory service

I'm trying to get my head round Angular services. I've created a simple example but when I try to utilize the service the console spits out an error (see below) app.js var myApp = ...
0
votes
0answers
51 views

Access controller and form names in angular directive

I'm not sure if this is the right approach. I have multiple forms with different controllers and i have one custom directive used by all forms. When user clicks RESET button from either of the form. ...
1
vote
2answers
35 views

How to enable auto watch angularJs?

I'm beginner with angularJs and have, as i think, simple problem with whatching changes in my $scope. I have an object $scope.tasks which i received from server. It looks like: { 2: {id: 2, name: ...
4
votes
1answer
58 views

Can I use controller in other controller in angular js?

I'd like to use Angular JS scrollbar to show content. Here are two controllers I want to use. module.controller('productsCtrl', function($scope){ $scope.products = [ ...
0
votes
0answers
20 views

Angularjs view refresh

I have a template which shows Exercise related data i.e. exercise name, intensity level, description etc. and a button to submit a rating to that particular exercise. All this data is fetched from ...
1
vote
1answer
113 views

Angular JS TypeError: $http is not a function

I have read through all the posts where people get this issue where $http is not a function, and it looks like for the most part it is due to injections being done in the wrong order. My module ...