0
votes
1answer
13 views

Controller is not getting updated factory value

I'm updating an object property in a factory and it doesn't seem to be updating the property referenced in the controller. Say I have a factory that looks something like this... app.factory('User', ...
0
votes
1answer
15 views

AngularJS - How to get directive-controller in directive with “require”

I have a directive with a require. Now I want to get the required controller instance AND the controller of the directive in the link function. How is that possible? If i set 'require' the fourth ...
1
vote
2answers
26 views

What is difference between following agularjs controller definition? [duplicate]

var app = angular.module('myApp', []); app.controller('myController', ['$scope', function($scope, []) { ..... }]); and var app = angular.module('myApp', []); app.controller('myController', ...
0
votes
0answers
21 views

Function decomposition of ngTables?

Attempt: $scope.ran_before = false; function table(provider, columns, params, data, parse_data) { params = new ngTableParams ( { page: 1, // show first page ...
1
vote
2answers
67 views

AngularJS call common controller function from outside controller

My basic premise is I want to call back to the server to get the logged in user in case someone comes to the site and is still logged in. On the page I want to call this method. Since I am passing ...
0
votes
2answers
41 views

angularjs directive controller $element

i see angularjs highly suggested not to do any dom manipulation in the controller, only setting the state of the scope, example pulling data from ajax etc, https://docs.angularjs.org/guide/controller ...
0
votes
1answer
46 views

updating controller over service not updating view

in my app I have an "Maps" to show and handle things on maps. A CtrlMap controller display the map and shows an marker. The watchPosMap watches position changes. 3rd there is an service called ...
0
votes
1answer
23 views

passing parameters to filter function defined on a controller

Say I have a (extremely simplified) controller defined like so: app.controller('myController', ['$scope', function(scope){ list=[1,2,3,4,5] scope.filterFunction = function(item, ...
0
votes
2answers
54 views

Directive talks to controller but cannot call functions residing in controller

I have a directive which needs to call functions from the Main controller but everytime i try to reference a function inside the directive nothing happens because it's undefined. When I access a value ...
0
votes
1answer
38 views

Initiating directive from controller

I'm having trouble figuring out a way to initiate a directive once the data has been returned. I'm trying to build a report using html tables and ng-repeat. The report object is generated using a ...
-2
votes
1answer
48 views

Avoid Hard Coding Controller name Angularjs

I am a beginner in angular..I have a requirement to avoid hard coding any names in the app.. I have used myapp.constant("constantName", { "name":"name1" }); to avoid hard coding html..I would ...
0
votes
1answer
37 views

Angular directive - when to prefer using a controller inside a directive?

I've been seing a lot of directive containing a controller in it. What are the pro / cons /differences and use cases compared to put the same code in the link function of the directive ? One ...
1
vote
3answers
64 views

Best practice for defining scope variables

I have this form. This form contains many many inputs like first name, last name, job title, notes, state, department, documents, supervisor...and so on Originally I had a controller like so ...
1
vote
1answer
38 views

AngularJS controller executes twice (not because of router)

From what I read, the most common cause of this problem is when the controller is included in the template and in the route provider. In my case, only the parent template containing this html is being ...
2
votes
3answers
110 views

How do I access the $scope variable of one controller from another in Angular.js?

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 ...
0
votes
2answers
42 views

How to convert this AngularJS controller in this module to another format?

I have this AngularJS controller; angular.module('plunker', ['ui.bootstrap']); var TabsDemoCtrl = function ($scope) { $scope.tabs = [ { title:"Dynamic Title 1", content:"Dynamic content 1" }, ...
1
vote
0answers
105 views

Using Restangular to add items from a nested array into an object in Angular.js

I have a model. The model has lot's of potential nested arrays. The item is a task and I can add a category to it for example. When I'm doing a new .POST how do I get the item's from the nested array ...
1
vote
1answer
166 views

How am I supposed to pass data from serverside controller an AngularJS controller?

I've encountered what I believe to be a common scenario, in which I am using an MVC pattern (specifically ASP.NET's MVC framework) for a web application, with AngularJS on the front-end. My problem is ...
1
vote
2answers
81 views

AngularJS cannot connect factory to controller

I'm sorry if this is an easy question. I'm new and probably don't understand the right things to search for to find the answer. I've basically followed this angularJS tutorial ...
0
votes
1answer
37 views

Angular app not working when web browser refreshed

I have an angularJS app, It is working well till I refresh my web browser. In my application, there is a JSON object that I get based on my login. It got a secession ID and a set of arrays in it. ...
0
votes
1answer
165 views

RequireJS and AngularJS multiple controllers

I'm using latest version of Require and Angular, but i encountered strange bug. I have controller for every view, but apparently works only for one view. This is my example code: Define all ...
2
votes
1answer
49 views

Directives & Controllers: resolve, loading, reloading [closed]

I need a code for the next problem. I know which components ($http, $q, etc.) I have to use. I don't know how to do it in a right way! So, I need an AngularJS directive or controller, It loads some ...
0
votes
0answers
213 views

excel file not getting after returning from Angularjs Service

I have situation where i have to call angularjs service method to post data to C# controller which in turns return me excel file which i want to save. here is code.... HTML : <div ...
0
votes
1answer
207 views

Angular ng-grid - How to remove row after submit in Modal

I have a grid of task items loaded by ng-grid that when clicked load more information in a Modal window, of the user clicks Submit then the task is set to inactive in the DB and I need it removed from ...
3
votes
1answer
2k 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 ...
0
votes
1answer
33 views

Can I give all controllers a new method that affect each controller's own scope?

In general terms Can I make it so that all controllers have a watcher that exposes a local scope variable or a method that affects only local scope? Kind of like traits. More specifically Out of ...
1
vote
2answers
1k views

AngularJS: open a new browser window, yet still retain scope and controller, and services

I'm writing an angularJS app. In this particular controller, I open a new browser window through the $window.open service. But in the new window, all the $scope variables are lost. I tried to use ...
0
votes
1answer
723 views

Angular.js best practice - extending controllers, overriding controller defaults

Here is a real-life Angular problem I can't wrap my head around. I love Angular, but this issue is bugging me a lot right now. I'm doing a dynamically generated form with Angular.js. Everything ...
2
votes
1answer
59 views

Getting just an object back from an asynchronous call

My goal is to show a username, which needs to manipulated on a web page. The mnaipulation should be done centrally in a service (MasterDataService). I want to used a scope variable on the screen which ...
0
votes
1answer
67 views

Service functions outside Angularjs scope

I have created a service in angularJS that uses btford.socket-io module to interact with the server. Since in the service I have implemented some API that I use inside angular at the moment, but for ...
0
votes
0answers
68 views

Leading/trailing slash in base url in angular controller

Our application running on following url format http://<server>/<app_name>/<private>, also this format http://<server>/<app_name>/<private>/ is working for us. But ...
0
votes
2answers
281 views

From an AngularJS controller, how do I resolve another controller function defined in the module?

Self explanatory fiddle: http://jsfiddle.net/5FG2n/6/ I need to dynamically choose the controller to use at runtime based on its name as a string. The string will be read from a config object. In ...
0
votes
1answer
77 views

How do I properly set a service property from model data in a controller in angularjs?

I've set up a service to share some data/state between multiple controllers. In one controller, I update some of the service properties with scope data through a save function. That data is then used ...
0
votes
0answers
39 views

ng-if / manually binding controller causes DOM Node count increase

I'm writing a directive to bind a template with a controller dynamically. During this, I found that the DOM Node count kept increasing, (and the heap size too). I'm wondering what is wrong with the ...
3
votes
1answer
79 views

How do I resolve and assign an inner controller from the outer's scope?

Self explanatory fiddle: http://jsfiddle.net/5FG2n/1/ Say I have a view with two controllers, one containing the other. The outer controller is static, but I need to set the inner controller based ...
1
vote
1answer
83 views

Creating a controller to each view in angularjs

I'm beginner in AngularJS and I want to create a controller to each view, but this file only can be referenced when I load the view, so: my app.js: var app = angular.module('app',['ngRoute']); ...
0
votes
2answers
314 views

Mocking the event object in AngularJS event unit testing

I have the following test: it('Should keep location when user rejects confirmation', inject(function ($controller, $rootScope) { var confirmStub = sinon.stub(), eventStub = { ...
2
votes
2answers
110 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 ...
0
votes
2answers
119 views

AngularJS testing error on adding name parameter to scope?

Error received when running karma start configs/karma.conf.js: INFO [PhantomJS 1.9.2 (Linux)]: Connected on socket PK-IbFeI1qpFq0fix6WI PhantomJS 1.9.2 (Linux) IndexController should add name ...
0
votes
1answer
105 views

AngularJS Redraw issue? Chrome only

Super new to AngularJS so please be patient with me :) We're using it to poll our API for updates while we process a repository (and after). On one particular page the data is loaded but not drawn ...
0
votes
1answer
301 views

Cannot extend angularjs controller in typescript

I am trying to inherit an angularjs controller using Typescript's extends. But as soon as I extend the controller angularjs throws this error: Error: Argument 'GenericLookupCtrl' is not a ...
0
votes
1answer
997 views

angular js: splitting up a large controller into multiple files

I have a controller that is getting rather large.. mostly due to all the input validation I need to do. What I'd like to do is split out all the validation functions into a separate "partial ...
0
votes
1answer
193 views

Use ng-if inside other directive with separate scope

Currently I've got the following HTML: <div ng-controller="WaitForViewCtrl"> <div ng-if="show"> ... </div> </div> WaitForViewCtrl controller watches ...
0
votes
1answer
48 views

Directive Inside another directive. Controller can't watch

I have 2 simple directives... the parent directive: .directive('modal', [function () { return { replace: true, scope: { /* attributes */ }, templateUrl: 'modal.tpl.html', transclude: ...
0
votes
1answer
324 views

Scope Variable Not Being Set Outside of Directive

I am attempting to create an AngularJS directive that sends a file name, from an <input type="file"> element, to a file upload factory. The work is based off the following blog post: ...
0
votes
0answers
705 views

Setting Model in AngularJS Control Not Updating View (something…)

I am experiencing issues with updating values in my AngularJS controller and having them properly reflecting in my model. I have the following form in my view: <form name="formSignIn" ...
2
votes
3answers
2k 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 ...
3
votes
1answer
413 views

Nested directives - cannot pass args to controller method from child directive in Angularjs

I'm having some trouble with nested directives in angularjs. I want to call a controller method from a directive within another directive and am trying to pass arguments to it, however they are ...
1
vote
2answers
125 views

ngInit not working asynchronously(with $q promise)

Edit: Plunker is working, actual code isn't: http://plnkr.co/edit/5oVWGCVeuTwTARhZDVMl?p=preview The service is contains typical getter\setter stuff, beside that, it functions fine, so I didn't post ...
1
vote
2answers
208 views

Evaluating expression in ng-controller

My Javascript var app = angular.module('Demo', []); app.controller('DemoCtrl', function ($scope) { $scope.expr = "Test" }); app.controller('Test', function ($scope) { $scope.HELLO = "HEllo ...