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

0
votes
0answers
10 views

Unable to have an ol3 map in each angular module

I'm using openlayers3 (ol3) and angular 1.5.6 on IE Edge. I have two modules. Each has their own controller and component. Each controller wants to have a map in the view. One view is for ...
0
votes
1answer
40 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
1answer
18 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
17 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
1answer
46 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: "...
2
votes
1answer
44 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
31 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
34 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 ...
3
votes
1answer
32 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
0answers
88 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. ...
0
votes
2answers
27 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 ...
0
votes
2answers
41 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
41 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
106 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 <!...
0
votes
2answers
27 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)* > - ...
0
votes
1answer
61 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 ...
0
votes
4answers
41 views

how angular directive bind controller's service data

controller: service.checkSub(function(data){ $scope.showSub = data.subscribe? false : true; }) directive: app.directive('showSub', function() { return { restrict: 'E', ...
0
votes
1answer
36 views

Simple AngularJS Controller Demo Not Working

I have been using AngularJS for some time now and this particular code block is not difficult by any means, but it's not working and there must be something extremely simple that I am missing here: &...
0
votes
0answers
28 views

Change element style before and after BootstrapModal action

I'm new in Angular and I want to know that is there a possibility to change <div> style using directive. Here is the function that is in controller: $scope.importData = function () { ...
0
votes
1answer
15 views

Combining Nearly Identical Controllers

In my angular application, I have two tables, each with their own controllers. These two tables use ng-repeat to present information retrived from a REST API. The controllers for these two tables ...
1
vote
1answer
38 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 ...
0
votes
0answers
20 views

What happens when you do not use $destroy() after creating an instance using $new() when unit testing AngularJS

I was looking for ways to unit test AngularJs when using the "controller as vm" style. I came across this (Karma jasmine and angular controller using 'Controller as' syntax (this instead of $...
0
votes
2answers
49 views

AngularJS, Catch a response from a service and use it in a controller

I have created a service and I have a responce, but I don't know how to use that responce into a controller. The service that I have: angular .module('MyApp') .service('telForm', function($http){ ...
-1
votes
1answer
18 views

How do I use this format of JSON in ng-repeat

This is the JSON and controllers im using: JSON Format: {"networks":[{"longName":"lo"},{"longName":"eth0"}]} Factory: app.factory('networkFactory', [ '$http', ...
0
votes
0answers
37 views

Removing a AngularJS component from the DOM and from his parent on click

i'm trying to show a list of users in AngularJS Each one would be user with a custom component element The components would have TWO buttons First one have to remove the component element from the ...
0
votes
3answers
47 views

How to isolate child controller scope from parent controller scope without changing the view?

Click on the parent button change also child but child button not. I need to change this behavior isolating scopes whith any hacks or other way. Child controller doesn't inherit from parent ...
1
vote
2answers
31 views

AngularJS - Data is not populating in table while using http service

I have a Web API which retrieves list of employees. Now when I call to $http service, I can get data from WebApi but it neither populated in table nor gives any error. Note: I am using angular v1.5....
1
vote
1answer
36 views

How can I call the function in controller from service

I would like to ask if is posible call function getItems(); in ItemController controller(It loads list of data) from fileUpload service(after upload image) - exaple bellow. After upload I want to ...
0
votes
1answer
32 views

Change in controller not reflected in view

I have 2 controllers based on the action taken in one controller, I need to update the data in the other. This is my code Controller 1 $rootScope.$broadcast('PackageIns', $scope.pkgtoLoad); ...
2
votes
2answers
47 views

share data between controllers getting/setting data asynchronously from a service - AngularJS

I'm having trouble with getting my custom angular service to work. My service is as follows: app.service('userService', function(){ var user = []; var setUser = function(newObj){ user.push(...
0
votes
1answer
49 views

Argument 'myController' is not a function, got undefined

I'm trying to setup some controllers in my angular app but I'm not sure why I can't make them working, since I think I'm using similar approach as I've done before. I declared app.js file: 'use ...
0
votes
3answers
62 views

cannot access angular service from external js file

this is my html: <html> <head> <link rel="stylesheet" type="text/css" href="css/style.css"> <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"&...
1
vote
1answer
44 views

Angular: Not able to access variables in controller using service

I am trying to share a variable between a controller and a function. But i get an error from the controller, saying this: TypeError: Cannot read property 'getSet' of undefined I have gone through ...
0
votes
1answer
48 views

get scope from a certain controller in angularjs

I try to test my angularjs app through QUnit framework. On the page mysite.ru/#/unittest/ - I use a controller called UnittestCtrl. But in my app I have a DetailCtrl and other page that I want to test....
2
votes
1answer
53 views

Angularjs TypeError: UserService.getCurrentUser.then is not a function at m.$scope.getCurrentUserId

I have an Angular controller and an Angular service. From my controller, I'm calling to the service.There are two functions in my Service. First function works fine. But this problem occurs with the ...
0
votes
1answer
36 views

uncheck the checkbox in checkbox list in AngularJS

I want to uncheck the checkbox from the list of checkbox depending upon the condition.Checkboxes are generated from the ng-repeat HTML <li ng-repeat="col in columns"> <span class="...
2
votes
2answers
70 views

Issues with AngularJS Controller

I have the following setup in my html file:: <body> <nav ng-controller="loginCtrl"> <div> <li>Apple</li> <li>Mango</li> ...
3
votes
1answer
58 views

Refresh the data in controller when scope gets changed in AngularJS

I'm pretty new with angular and I've read a lot of threads here and googled this topic but I cannot get a clear answer. what i am really trying to achieve is. lets suppose I have a controller A, this ...
0
votes
0answers
16 views

Angular Interval losing scope [duplicate]

I'm building an angular app for the first time and I've got a controller which is used to monitor the health of a system. The health data comes from a rest api which I can hit and get the data ...
1
vote
2answers
49 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 ...
1
vote
1answer
302 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
56 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+ "/political/ElectionType/...
0
votes
1answer
27 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
62 views

index.html page not loading in controller

in app.js $routeProvider.when('/', { templateUrl : appUrl + '/index.html', controller : 'HomePageController' }); in controller.js angular.module('PoliticalOrg').controller('...
0
votes
3answers
68 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
57 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
51 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
44 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
57 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(...
2
votes
1answer
46 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"; ...