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
619 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 ...
3
votes
1answer
543 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 ...
2
votes
1answer
112 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
1answer
161 views
Controller function calls more than once in AngularJs
I am making mobile application with using JQuery Mobile and AngularJs
I am currently using single page structure here is my sample
<body ng-app="myApp">
<div data-role="page" ...
2
votes
1answer
2k views
Argument 'PricesController' is not a function, got undefined
I am relatively new to angularjs so please bare with me. I have looked at a lot of examples related to setting up the app, and everything I'm doing seems correct but I'm still getting the error ...
2
votes
1answer
105 views
What is the difference between passing a function and array as an AngularJS controller?
Both of these work, but what is the actual difference between each implementation? I'm sure there is a logical reasoning behind each method, and I wish to be enlightened.
...
1
vote
1answer
28 views
AngularJS, Using a Service to call into a Controller
I am new to Angular, what I would like to accomplish is: From a Service / Factory to call methods directly into a controller.
In the following code, I would like from the valueUserController I would ...
1
vote
1answer
88 views
Factory property is null when accessing directly from controller Angular
I'm trying to build simple loggin with angular and rest api and I've got strange problem with checking whether user is logged in login form controller.
Here is my code:
everytime I refresh my app it ...
1
vote
1answer
54 views
How to remove repetitve function from angularjs controller
Hi i am writing some code staff under angularjs but i has to make duplicated code from controller to other for example let's assume that we have two controllers editProductController and ...
1
vote
1answer
154 views
ng-include directive and ng-controller option with variable
I have a question about using ng-include and ng-controller together. In the same element, the ng-include and ng-controller are at the same element, I take the url to do modification.
...
1
vote
1answer
32 views
Angular not scoped method
I am wondering, does all the methods declared in an angular controller have to be added to the scope?
is it possible to call a controller method from ng-click="myMethod()", with my method not delared ...
0
votes
1answer
34 views
ng-repeat, ng-click, directive, and controller interaction
I have this directive snippet:
return {
scope: {},
restrict: 'E',
templateUrl: 'partials/order_table.html',
controller: 'OrderController as x',
link : ...
2
votes
0answers
147 views
Angular directive in ng-repeat doesn't call link
I'm fairly new to Angular and am having some trouble getting a directive to render within an ng-repeat. This is probably a lack of experience on my part so any help is greatly appreciated.
Here are ...
1
vote
0answers
33 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
169 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
561 views
angular directive for tables: bind transcluded elements with ng-bind-html
I'm trying to write a generic table directive like this:
<h-table rows="customers">
<h-column field="Id">
<a ng-click="editCustomer(row.Id)">{{row.Id}}</a>
...
1
vote
0answers
406 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 ...
0
votes
0answers
13 views
how to fill combo box on page load in angular js?
I have a page which has two combobox in it. This is my view :
<div ng-init="loadComboBox()">
<select class="form-control" ng-model="SelectedItem1" ng-options="employee.FirstName for ...
0
votes
0answers
24 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
55 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
23 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
26 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
25 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
33 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
24 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
45 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
151 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 ...
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
19 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
34 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
141 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
141 views
Angular-ui bootstrap modal without creating new controller
plunk: http://plnkr.co/edit/85Wl5W If I use the $modalInstance on the same controller(modalController.js), without being in a modal, angular gets frozen.
I just want to simplify my life using ...
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
43 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
40 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
33 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
308 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
92 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
98 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
51 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 ...
0
votes
0answers
42 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
60 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
752 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
254 views
ng-repeat load new updated array model but do not clear the previous value of array in template
I have a list of articles, every article has a list of comments with user.name and user._id of that comment. Click to each user, it shows a chat box to send message to that user. Everything is ok with ...
0
votes
0answers
259 views
Dynamic routing with dynamic controllers in AngularJS
I am currently using require.js and angular. Since I have a very long list of custom views, each for a different task, I've cooked up a way of including them dynamically using requirejs.
First a ...
0
votes
0answers
359 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
272 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
260 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
52 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 ...
0
votes
0answers
424 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. ...