Tagged Questions
3
votes
1answer
521 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
503 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 ...
2
votes
1answer
108 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
156 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
103 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
79 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
43 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
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
23 views
Accessing Parent controller variables in child controllers Angularjs
I have an issue, i would like to take your suggestion on this.
I have used child controller inside parent controller div . e,g,
<div ng-controler="parent">
<div ...
0
votes
1answer
53 views
Sharing a controller scope between two directives with isolate scopes in AngularJS
I have two directives that provide different views on the same set of data. Both of these directives need to rely on central functionality contained in a controller. The controller uses various ...
0
votes
1answer
46 views
Call controller method from directive
I have a button which change the "active" state. First, it loads the status from the server
<button active="data.active" ng-click="changeStatus()"></button>
directive code:
...
0
votes
1answer
28 views
Global search using filters and services
My purpose is to create a global search toolbar, where I can search any data in the app.
I'm already using filters to search a single type of resource, like :
<div ng-repeat="project in projects ...
0
votes
1answer
48 views
Update AngularJS Controller Scope from Another Controller/Scope
Hopefully this hasn't been asked.. I looked around and haven't found anything yet.
I have a single view that provides the user with a modal dialog (wizard) to create a few things and then save them. ...
0
votes
1answer
65 views
using angularjs controller that consumes a service promise inside the view
I have an controller that consumes an angularjs service promise. I have written jasmine unit tests against the controller and therefore the controller function looks like:
this.getTodos = function () ...
2
votes
0answers
121 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
31 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
155 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
400 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
22 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
21 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
22 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
21 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
23 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
23 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
26 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
76 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
32 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
101 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
94 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
32 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
41 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
32 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
462 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>
...
0
votes
0answers
294 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
84 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
93 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
49 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
59 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
743 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
255 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
357 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
261 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
259 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
51 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
409 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. ...
-2
votes
0answers
36 views
Angular JS Controller not working
I am new to AngularJS, and unable to figure out why this basic controller is not working given the following code. It should take in two numbers and run a simple calculation(addition or ...