The angularjs controler 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
0answers
72 views

Angularjs, need best solution to move dynamic template formation and compilation code of multiple directives from controller to custom directive

I need to display multiple angularjs directives in a single page on tab click. It could be a combination c3 chart directives and ng grid directives. I am preparing the model with all these relevant ...
1
vote
0answers
60 views

Accessing parents methods using controllerAs syntax in directives

I have a couple nested directives. I'm trying to be consistent and use the controllerAs syntax. But I'm struggling to find a clean way for children to call parent methods that doesn't include a ...
1
vote
0answers
88 views

How to go back to previous page without refreshing in angularjs?

I currently have an AngularJS application with routing built in. It works and everything is ok. where i have 2 controller. in first controller i have a button when i click button 2nd controller will ...
1
vote
0answers
299 views

Accessing parent scope from a child controller with ControllerAs syntax

How can I achieve the following using Controller-As approach: app.controller("parentCtrl", function($scope){ $scope.parentObj = {prop1: "not set", prop2: "something"}; $scope.doSomething = ...
1
vote
0answers
58 views

getting an error : Argument 'ctrl' not defined in angular js

my index.html file has the following : <script src="scripts/controllers/form/DashboardCtrl.js" /> <script src="scripts/controllers/chart/morrisChartCtrl.js" /> my app.js file is as ...
1
vote
0answers
222 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
0answers
409 views

How can I write generic Angular JS controller logic?

I'm using Angular JS to work on a proof of concept for a SPA that needs to be able to handle dynamic form generation. This project is essentially an interview style application that will have a user ...
1
vote
0answers
483 views

AngularJS - “10 $digest() iterations reached” when ng-view ng-repeat dependant on $routeParams

I am really new to Angular and this is the first time that I am dealing with routing, so please excuse me if my questions are a bit confusing. My actual logic and structure for this app is much more ...
1
vote
0answers
570 views

AngularJS: Sample ToDo App - Questions and Review

I know there are tons of AngularJS ToDo apps/topics out there and I've read quite a few of them to get a basic understanding of AngularJS, how things work and the idea people put behind their code. ...
0
votes
0answers
20 views

Can a Controller be Eagerly Loaded in AngularJS?

I am using UI router to define several states and their child views. I set their controllers accordingly as well. I'd like one or more of those controllers to be active before the view is loaded, ...
0
votes
0answers
49 views

$rootScope object not available in another controller (but is available in view)

I have a user authentication service that creates a currentUser object when the user is logged in. This is available to all views, but I can't seem to get it available to another controller. I'm ...
0
votes
0answers
24 views

AngularJS - Strange behavior with broadcast events

I have app-controller.js which send events across different states using UI Router which are nested in a view: app-controller.js // Online document.addEventListener("online", function(){ ...
0
votes
0answers
29 views

$watch on directive link function does not read updated value

So i've been going around this one the whole morning. And after going through the docs and a lot of stack overflow questions I decided to throw the towel. Scenario is, I have a directive where on the ...
0
votes
0answers
28 views

Creating a directive that will generate menu items using ng-repeat inside a defined template

I have a template as below: <li ng-click="action()">{{name}}<i class="icon-li{{icon}}"></i></li> The action() is something that will change as per the JSON object and ...
0
votes
0answers
32 views

How to watch the active tab in angularjs to be able to call $interval.cancel function for running scripts in different tab?

I'm using angular and my app consists of different content. Tab 1 contains widgets, while the rest is plain text. This is one of the controllers that will get the data of widget from server. I have ...
0
votes
0answers
25 views

How to dynamically include controller from string for directives?

I need to dynamically choose the controller at ngRepeat based on component name as a string. Plunker: http://plnkr.co/edit/osLLf0c4eNCpNokyyXCI?p=preview As you can see I found a solution, but I ...
0
votes
0answers
54 views

Generate Templates in Angular JS dynamically based on server side configuration file

Folks, I am willing to create a user interface that will work with any storage server that exposes them over REST api. Here is more detail and challenge faced : A configuration file resides ...
0
votes
0answers
15 views

How to divide responsibilities between a directive controller and link function

I have been reading a lot on this topic but haven't yet grasped much difference in how each is used...for eg if I registered a $scope.$on handler on a particular event in a directive controller how ...
0
votes
0answers
75 views

angular ng-src doesn't refresh an image

I am doing a functionality of selecting an image from the image list. I have a button "select" from every button and call selectImage method on button-click. AngularApp: app = ...
0
votes
0answers
23 views

What are the performance differences in using a service to share data between angularjs controllers vs $emit / $broadcast vs nested views?

I know from experience that internal communication between controllers should--when at all possible--not be implemented using $emit and $broadcast with $watch--this introduces perhaps unnecessary ...
0
votes
0answers
91 views

Uploading images using ngImgCrop: always transparent png's or black jpeg's

I have a pretty basic angular controller, the HTML of which looks like; <div class="panel panel-default" ng-controller="PlaceInfoVisualCtrl"> <div class="panel-heading"> <h3 ...
0
votes
0answers
88 views

How can I get around “Blocked loading resource from url not allowed by $sceDelegate policy. URL: login.html”

I amusing Nodejs and creating a single page app. Locally everything is working fine. When I deploy to my AWS server, I get the follow error (Blocked loading resource from url not allowed by ...
0
votes
0answers
33 views

Load controller dynamically without routeProvider

so i have my index.html like following <html> <body ng-controller="Ctrl"> <div id="main" ng-include="body"/> <div id="sidebar" ng-include="side"/> ...
0
votes
0answers
50 views

Accessing properties of directive's isolated scope from controller

I'm trying to access the properties of my directive's isolated scope. Im slightly new to angularJS so I'm unsure if this is actually possible or not. Below is my code: ...
0
votes
0answers
62 views

How do I properly initialize/mock and unit test input data in a directive's externally-defined controller?

I have a custom directive that uses an external controller and template. The user passes in some initial data to the directive, which is used inside the controller. When I'm unit testing ...
0
votes
0answers
55 views

AngularJS logic distribution in directives between compile, link and controller

I've got a fairly theoretical question, but first let me go through a quick introduction. What I have is a directive that contains a form. Form elements are individually validated on blur (which ...
0
votes
0answers
454 views

Controller loaded by ng-include not working

I have a page with a pop-up I use on several pages and I load it using ng-include. In this pop-up there is three tabs also dynamically loaded using ng-include. So my code looks like this: <div ...
0
votes
0answers
71 views

Why using $watch on a directive attribute is not working?

I have directive that use another directive that is setting his property 'gridWidth', but I'm trying to watch that property changes and its not working at all. Can anyone explain what I'm doing wrong? ...
0
votes
0answers
141 views

How to create a datetime-local input DOM with angularjs and Ionic?

I have the following Code that I would like to learn how to refactor out html and place into my Angular controller. <a class="tab-item "> <input type="datetime-local" ...
0
votes
0answers
21 views

Extend controller's $scope keeping the same controller name

I have multiple modules in my AngularJS application. Core module defines the HeaderController which is attached to the HeaderDirective. Users module attached on top of the base application and ...
0
votes
0answers
82 views

Register a controller with nested controllers AngularJS

I need to dynamically register a new controller. So far I've used this code in order to do so after I've loaded the controller js files: var queue = angular.module(moduleName)._invokeQueue; ...
0
votes
0answers
65 views

Using different controllers on the same directive in AngularJS

I have created a directive and service that combine to create a pop-up modal in our application. I can call the pop-up service which sets up a scope variable and causes a modal directive to become ...
0
votes
0answers
57 views

Angular Widget using jQuery

I am trying to write a widget which will show up on button click. This is a jQuery representation of what I want to achieve. jQuery (This is not my code. Found this one on net) I am not sure how to ...
0
votes
0answers
82 views

Using 2 websockets in one Angularjs controller

I have 2 websocket services: one for historical data and another for current event. Before the current event starts, I want to display historical data that loops through the years. Once the event ...
0
votes
0answers
34 views

Dependencies no longer available in init or other controller defined functions

I have the following simple module definition: var myApp = angular.module('myApp', []); myApp.controller('MyController', ['$scope', '$q', function ($scope, $q) { debugger; ...
0
votes
0answers
106 views

Error defining AngularJS Controller

I am starting with AngularJS, creating my first App & Controller I get this error: Error: [ng:areq] ...
0
votes
0answers
63 views

can controllers be separate files while sharing data between controllers through a service?

I'm doing something like this: How to create separate AngularJS controller files? But I'm trying to share data between these separate controllers using a service. I'm unable to do it. Can you tell ...
0
votes
0answers
189 views

Angularjs reload part of the document

I know that the whole page can be reloaded using the $window.location.reload(); but is it possible to just reload one part of the page? I'm building a mobile app and it loads the data from the local ...
0
votes
0answers
107 views

Angularjs - inject controller dependency automatically in $scope

Is there a way to inject automatically a dependency (or a resolve) in the $scope without manually append it to $scope ? (with or without UI-Router) Would the "controllerAs" syntax be of any help ? ...
0
votes
0answers
95 views

getting : undefined is not a function on getting collection from web-api

I have a web api which returns IHttpActionResult(myCollection) on Get. My angular JS controller is has a function : $scope.loadcollection = function($defer, params) { console.log("inside ...
0
votes
0answers
34 views

Isolating large amounts of information into factories from controllers (AngularJS)

I'm a little new to Angular, so I'm not really sure what the standards are when it comes to writing an app that has something like this. I had some functions and content I needed to share across ...
0
votes
0answers
140 views

AngularJS: Communicating to a controller function outside ng-view controller

Can someone help me in the following scenario.. I am developing a two page application say dahsboard and search. In my index.html, I created a header view with header controller and ng-view to load ...
0
votes
0answers
16 views

Obtaining a reference to another controller function from within a controller

I want to dynamically set ng-controller within an ng-repeat. See this question for more details. The linked question shows how to do this by defining the controller functions in the global ...
0
votes
0answers
31 views

How different controllers can relay of each other while page is being loaded?

Think about this simple scenario: <div ng-controller="ctrl1"> ... drop down list... </div> <div ng-controller="ctrl2"> ...grid list... </div> The first <div> ...
0
votes
0answers
49 views

AngularJS factory and controller

little problem here, i have a controller which communicate with factories, but how can i pass the factory result to a function? Something i tried: .controller('testCtrl', ['$scope', 'foo', 'boo', ...
0
votes
0answers
295 views

Angularjs initialize multiple controllers at startup?

i have a normal navbar with a menuController, this is the parent. then i have two other controllers a DashBoardController this is loaded on startup and a LoadDataController this is called if i click ...
0
votes
0answers
34 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 ...
0
votes
0answers
67 views

Associating a controller with a nested template?

Angular lets me associate a controller with a template in several different ways: With anguluar-route: app.js $routeProvider.when('/foobar', {controller: "FooCtrl", templateUrl: ...
0
votes
0answers
83 views

$scope.$digest throwing“No more request expected ” in angular controller unit test

Controller code : $scope.$watch('model.time_zone', ((newValue, oldValue) -> return if (newValue == oldValue) if newValue == originalTimeZone $scope.timeZoneChanged = false else ...
0
votes
0answers
44 views

detect which directive calling a method in the controller

is there any way to detect which directive calling a function in the controller without passing any arguments from the directive itself. simple example to demonstrate what i need: controller: ...