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.
3
votes
1answer
169 views
How to dynamically load controller to a directive
So I have a directive that Will be acting as a side panel in my app. When a user clicks a button the side panel will open. In said side panel I need the controller and view for this area to be ...
2
votes
0answers
3k views
AngularJS: $scope.array.push() does not update the view, even with $apply
I'm trying to learn AngularJS and there is this thing that I don't understand, which seems like all the internet solved by using $scope.$apply, but I already use it and it does nothing.
Basically, I ...
1
vote
0answers
27 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
41 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
97 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
51 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
194 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
442 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
547 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
23 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
23 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
19 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
48 views
Angularjs scope variable not showing
I have a problem with a nested controller.
View and controller are here:
<div ng-repeat="comment in comments | reverse" ng-attribute-id="{{ 'commentContainer_' + comment.comment_id }}" ...
0
votes
0answers
19 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
32 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
115 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
52 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
80 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
17 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
56 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
49 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
42 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
67 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
29 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
82 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
40 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
79 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
74 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
67 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
31 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
97 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
27 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
41 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
247 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
33 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
55 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
67 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
38 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:
...
0
votes
0answers
344 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
0answers
111 views
Controller Design in AngularJS
I'm trying to follow some best practices outlined here:
http://trochette.github.io/Angular-Design-Patterns-Best-Practices/#/inheritance_pattern
And building my controller like so
...
0
votes
0answers
107 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
0answers
44 views
Should i set controller on directive or on the state config
I have a question concerning the location of placing a controller on my angularJS app.
this is a snippet of my app.js:
var myApp = angular.module('myApp', ['ui.router', 'ui.bootstrap']);
var ...
0
votes
0answers
68 views
Clear form after submit and disable form in angular service
I create a service to upload content.
it takes 4 argument
which folder to update
the content
set the form to disabled
clear form after submit
create: function(folderID, text, o, master) {
...
0
votes
0answers
775 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" ...
0
votes
0answers
375 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 ...
0
votes
0answers
326 views
AngularJs :: Load Data In DropDown on base of other Dropdown
Load data in my first dropdown from AngularJS then on the basis of this dropdown i want to generate next dropdown with data from another controller
<ul data-role="listview" data-inset="true">
...
0
votes
0answers
269 views
AngularJS - Create a directive to fire an event (function) when the current element is appended to the DOM
I am trying to find a way to detect when an element is finally appended to DOM? Is there any directive that I can create and attach to that element so it will detect the moment of appending? By ...
0
votes
0answers
54 views
Trouble with editing objects in AngularJs
EDIT: the code on the plunkr works as it should, but not on my local machine, the only difference is that locally edit-website.html template is stored in partials folder, which is refferenced in the ...
-1
votes
0answers
28 views
cant access object property from angularjs service
So I am trying to get a property from service and currently when I call the property directly through the scope I get the initialized value from the service I injected. But if I spit out my service ...