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.
1
vote
0answers
46 views
Not able to display data passed from MVC controller to Angular Factory
I am New to the concepts of Anglaur Js and I am stuck here on this problem since very long time the I am returning a list<> type User from MVC controller json but I am unable to load my user ...
1
vote
0answers
40 views
Cordova/Ionic httpd server plugin - url not visible
i have a problem with Angular controller in my Ionic/Cordova project.
Can someone explain me why url which i get in line 25: $scope.serverURL=url;
isn't visible in line 63 alert($scope.serverURL); ...
1
vote
0answers
182 views
Angular controller as vm not available in $resource.$save callback function, only $scope
I am having an issue in AngularJS when not wanting to use $scope but a controller instead in a callback function passed to $resource.$save() as parameter.
The controller code is shown below. This ...
1
vote
0answers
274 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 ...
1
vote
0answers
64 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
400 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 ...
1
vote
0answers
336 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
481 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
537 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
610 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
24 views
Making a directive load before ngController
I am trying to get experience with angular by making an app (for my own use) and I ran into an issue.
I decided to try to implement lazy loading (like in the "Complex" part of the answer to this ...
0
votes
0answers
13 views
Access to form data that submitted by an unknown source
Scenario:
Another web application get a link from my web app and then POST some data to the link, like this:
<form action="http://www.example.com/mylink">
<input type="hidden" ...
0
votes
0answers
37 views
No data coming through when passing an array to an AngularJS controller using a function
I am working on an angularjs application which uses parse to create an array of names. I then pass that array to a controller, which I use in my html. My problem is that no data is coming through and ...
0
votes
0answers
27 views
Using ng-style with controller data
I'm trying to fill the space behind a <navbar> to make sure I have nothing hidden behind it.
First, I'm getting the height of the <navbar> in my controller like this :
'use strict';
...
0
votes
0answers
19 views
lazy loaded controller results in error when transitioning to state
Receiving this error...
Error: [ng:areq] Argument 'registerController' is not a function, got undefined
when attempting to transition to a ui-router state...
.state('register', {
url: ...
0
votes
0answers
39 views
AngularJs 1.3.11 - Directive is not updating html
Directive Template (Template.html):
<div class="someContainer">
<div ng-repeat="obj in data" >
<a href="{{obj.linkUrl}}" target="{{obj.linkTarget}}">
</a>
...
0
votes
0answers
40 views
Use variable from directive (after http post) in the controller (scope)
I'm having problems to set a variable from the directive and use it in the scope of my controller.
In my directive I have:
function full_calendar($http, $compile) {
return {
restrict: ...
0
votes
0answers
26 views
Using $compile function in AngularJS
I am new to AngularJS, I am working on a calendar directive, understanding and modifying this code calendar fiddle, this is the static one showing only present month with highlighted date, but I want ...
0
votes
0answers
33 views
How to declare a watch on the this object in a factory method in angular js?
I have a factory class defined which i am instantiating in the controller.
I want to define a method in the factory declaration of the User class which will be notified to when any of its properties ...
0
votes
0answers
45 views
Loading data in another view on menu item click within ngrepeat
I am new to AngularJS. I have a rest service which provides json response and I use this response to build a navigation menu. This response has following structure.
Menu Item A
Menu Item A1
Menu ...
0
votes
0answers
30 views
How to replace declarative view filter with dynamic filter function
I have constructed a declarative filter that factors group-based weighted averages. Problem is that when a new group is added I have to create additional view-side rules and reference index id. ...
0
votes
0answers
19 views
How to get the location of the click on the SVG file in angularJS?
I'm building a site in angular that load a SVG file. On the SVG file I have a class (".clickable").
I current have my factory that pulls the SVG files and it return the data to my controller that ...
0
votes
0answers
75 views
Avoiding duplicate code in angularjs forms and controllers
I am writing an angularjs app with a simple CRUD service at the back-end. Every page contains a form and many elements are common between multiple forms. Some of these elements (dropdowns) trigger ...
0
votes
0answers
25 views
keep an $injector reference in a controller
Based on all my readings regarding on how to implement a killer controller, here is how mine is looking:
angular.module
.controller('MyCtrl', MyCtrl)
;
MyCtrl.$inject = ['service1', 'service2', ...
0
votes
0answers
64 views
Angular - service for holding data, controller as the glue - also big data?
I often read, that you should not hold data in the controller and use a service instead. And use the Controller more as a glue between the view and the service.
So I really to follow this rule and ...
0
votes
0answers
25 views
Injecting a function into a Angular run
I have my current module with a .run and I want to have it call and run a functions inside the .run
I have created the function in a .factory but when I inject the factory name inside the .run and ...
0
votes
0answers
36 views
Change Template of a 3rd Party AngularJS App
I am a AngularJS beginner and I want to change the template of a 3rd party AngularJS app.
The template was stored in a variable and compiled.See below:
return {
restrict: 'EA',
...
0
votes
0answers
52 views
Upgraded to 1.4.1 and now: Argument 'SearchPopover' is not a function, got undefined
First I had to fix the following:
controller: SearchPopover
Changed to
controller: 'SearchPopover as spop',
My Directive & Controller below, I've tried:
.module('searchPopoverDirectives', ...
0
votes
0answers
72 views
angularjs: decorating $log function to set a variable in my app controller
I have an Angular application using the sockjs module and want to show on screen, when there is no connection. As sockjs sends the log command "Connected!" / "Disconnected!" when there is a / no ...
0
votes
0answers
344 views
angularjs TypeError: Cannot read property of undefined
Hey guys I'm having some issues with the following code as it is producing a TypeError even though I thing I've made sure that all the appropriate directives are accounte for
...
0
votes
0answers
47 views
Unit testing controller triggering custom directive
Suppose you have an angular+jasmine app and your controller looks something like this:
app.controller('MyController', function($scope) {
$scope.myFunc = function() {
$scope.myArray = [];
...
0
votes
0answers
29 views
$rootScope.$on in controller Angularjs with websocket service
I am using websocket to broadcast data to controller. Full code for the websocket factory is at: angular websocket factory.
In controller I receive data:
$rootScope.$on('broadcast', function () {
...
0
votes
0answers
37 views
How can I efficiently use window scroll detection in Angular that can be used by multiple other directives/controllers?
I'm building an animated landing page using AngularJS. I am wondering what is the "best-practices" way of detecting page scroll, in a way that the scrollTop value can be passed off appropriately and ...
0
votes
0answers
128 views
Angular JS - Binding angular expressions coming from JSON to HTML
Is it possible to give angular expression inside a JSON file like this:
{
"headerHTML": "<div>{{clippedCoupons}}</div>"
}
And bind it to a directive template like this (the below ...
0
votes
0answers
24 views
How can I verify with angularJS that all controllers on page have finished to refresh?
Think about next scenario:
I have page with a few controllers/directives. Each one of them has method to "refresh" himeself.
I have a refresh button for the all page that just fire event and all ...
0
votes
0answers
127 views
How to make an accordion with d3 and angular?
I am trying to make an accordion with D3.js and Angular.js. I have taken code from a couple different places and tried to piece it together to get it to work with not much luck. Here is what I have so ...
0
votes
0answers
57 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
140 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
34 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
59 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
36 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
100 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
53 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
104 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
37 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
197 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
37 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
246 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
42 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
112 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 ...