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.
0
votes
1answer
24 views
Angularjs bad argument ng:areq error
I'm getting this error when running my application. This error comes in only one controller. I have done other controllers in the same way but in this particular controller I get this following error.
...
0
votes
0answers
36 views
Angular prevent other controllers execution
I have a strange problem, Angular keep execution of other controller when I'm in MainCtrl. Why other controller methods are execute and how I can stop that?
Here is my code
app.js
...
0
votes
1answer
19 views
Using Angular Factory Service
I'm trying to follow Code School's Staying Sharp with Angular Soup to Bits.
I've come to the point where I've created a note factory service and implement the $resource service.
I $scope.notes = ...
0
votes
1answer
40 views
Passing data between controller in AngularJS
I tried to pass data between controller and I made a service to do that. But somehow when I tried to get the data, it doesn't work. I have no idea where my mistake is. Here is the code:
This is the ...
0
votes
2answers
28 views
How can I set a variable into ng-repeat from controller?
I have this variable in my Controller:
$scope.numeroDescontos = 5;
I have one button that iterate the variable, and I want to build one 'ng-repeat' using that.
What's the best way to do that?
0
votes
0answers
27 views
Pure Controller objects
In AngularJS, a Controller itself is an object defined by a Javascript constructor function and this constructor function is a callback to .controller method.
var myapp=angular.module('scopeExample', ...
1
vote
1answer
105 views
Can one inject a directive $compiler into a service?
I'm trying to output a directive as a javascript string so that I can place the html in a code display window. I'm interested in the actual code rather than the browser rendered version because I'm ...
0
votes
1answer
22 views
log message if Api service status == 404 in angularJS
I have this code in my service.js
function myService($http, $log) {
var API = 'https://myapi.net/api/api.php?';
$log.debug(API);
return {
getApi: function(inputValue, inputValue2) {
...
0
votes
1answer
41 views
Angular Component: how to specified value for output binding function defined in parent?
I wanted to use Angular 1.5's component to get benefit from its one-way binding: <hero-detail hero="ctrl.hero" save="ctrl.save(hero)"></hero-detail>. But, as Todd Motto points on his blog: ...
0
votes
0answers
17 views
How should a controller be specified in a directive?
Assume we have these 2 snippets, what's the difference between controller: function (...) { } and controller: 'myController'
app.directive('testDirective', function () {
return {
restrict: ...
0
votes
0answers
12 views
Karma jasmine testing for controllers
I have a controller defined inside $stateProvider.state for which i am writing some unit tests. The issue is this controller is not defined with a name and i am not able to access it.
Controller ...
1
vote
1answer
31 views
Angular app with ui-router not hitting controller unless its inline function
I am having trouble with ui-router. If I use an inline function it works, otherwise when I click on the route the controller is not used. I can debug the browser and the js is being delivered but no ...
1
vote
1answer
27 views
angular directive controlleras and link
I have markup like this
<i class="fa-font icon-user" wd-user-profile></i>
to show / hide this div
<div id="user-profile" ng-show="vm.isVisible">
<h3>user name</h3>
...
0
votes
0answers
26 views
Organizing a composite angular js directive
As part of creating a complex grid control, I've been writing a directive which builds this composite control that uses multiple controls within. The master control consists of a core grid control, a ...
0
votes
1answer
20 views
Angular Unit Testing: Isolate certain components defined on module
I've inherited a large AngularJS project using Karma and Jasmine and am trying to follow the conventions that were set out before me, but am having trouble unit testing directive/controller modules. ...
0
votes
3answers
22 views
Not being able to iterate through inputs within scope
I'm trying to iterate through an array created using angular, so I can add them up and then show them, but the problem is, I'm getting an error saying that property '1' of undefined even if I fill out ...
0
votes
1answer
43 views
Angular 2 component inside Angular 1?
I want to add an Angular 2 component inside my Angular 1 controller, so the Angular 1 controller is a parent and Angular 2 component is a child. I would like a child and parent be able to exchange ...
1
vote
1answer
35 views
In AngularJS, how do we decide to have one or more controllers?
Let's say if a page has the left panel with some items to choose from, and the right side having a "cart" panel, then would it be good to have 2 controllers: 1 for the left panel, and 1 for the right ...
0
votes
1answer
39 views
Order and Groupd Data By Year and Month
I am trying to show a list of payments made for a particular product. So, if i purchased a product for $2000, i would could set up a monthly payment of $100 and i want to try and track if that payment ...
0
votes
1answer
50 views
Angular JS : How do I Lazy load my directive?
my html structure is like below
main.html
<div class="row">
<div class="col-xs-9" id="myResultPage">
<!-- Code for service call to get the results ...
0
votes
2answers
29 views
Select with multiple columns in AngularJS not working properly?
Demo link
Hi all,
I created a sample for select with multiple columns in AngularJS. which is working fine if I pass the value directly like this:
$scope.rowDatas = [
{ ID: ...
0
votes
1answer
23 views
How to pass routeparams value in model window angularjs?
In my project I am trying to implement modal window for the edit screen. I have listed screen where users need to select one row from the list and click the modify button. I need to open the edit ...
0
votes
1answer
38 views
What is OWASP ? why we need that? [closed]
I read some documents they said OWASP is used for security purpose for web application. But Am not clear about that. can any one tell me the purpose, what is the difference normal app(without owasp) ...
0
votes
2answers
52 views
Angular.js controller that uses multiple services
I can't seem to figure how to inject multiple services into a controller.
I have listed my files here:
index.html file:
<script src="'./angular/angular.min.js'></script>
<script ...
4
votes
1answer
42 views
Change a value inside ng-repeat cycle with ng-click
I want to change a value of an item inside an ng-repeat cycle using a function.
This for example won't work.
HTML
<ul class="unstyled">
<li ng-repeat="todo in todoList.todos">
...
1
vote
3answers
81 views
How to test response from service within controller
I am trying to test the response from a service http call that is performed within a controller:
Controller:
define(['module'], function (module) {
'use strict';
var MyController = function ...
1
vote
3answers
45 views
AngularJS: code not working when iterating through object [duplicate]
I am trying to populate a list of employee objects from my controller empctrl in a template.
Here's the controller:
app.controller('employeeController', function ($scope, employeeService) {
...
3
votes
1answer
41 views
ng-repeat not working with onsen ui
I'm going nuts, this is such a small thing but I can't find a solution...
I have this js file (the angularjs app is initialized in the begining of the html document)
app.controller('slidingMenuCtrl', ...
0
votes
1answer
29 views
Mock Service Within Controller Returning Undefined
I am trying to test something pretty simple: a controller that calls a service that performs a http request.
Controller:
define(['module'], function (module) {
'use strict';
var ...
0
votes
9answers
77 views
Cannot write a basic controller AngularJS
Forgive me if my question is too basic. I am learning AngularJS's controllers.
This is the project structure.
This is my html:
<!doctype html>
<html ng-app>
<head>
...
0
votes
1answer
28 views
How to read variable of a directive from a controller in angularJS
I downloaded an angularJS module which does multi date picker for me (composed from 1 factory and 1 directive), and I integrated them in the module that I am already building.
It works fine even ...
1
vote
2answers
43 views
Angular JS: can we set resolve or promise on controller which did not have route defined?
I am trying to fetch some data from server before controller get render.
I have found many answers for it with respect to routeProvider.
But my main issue is my controller does not bound with any ...
0
votes
1answer
39 views
Pass $scope data from controller to view
I want to display $scope.predicate and $scope.reverse values into my view(in the <p> tag ). It seems that using {{ }} expression is not working.
app.js:
var app = angular.module('testApp', ...
-1
votes
1answer
49 views
How to get Values from Other AngularJs Controller $scope variable
I'm having two controllers namely AController and BController.
I need to get the value of Controller AController's $scope.myName to the Controller BController's $scope.myName.
Note: Here I'm not ...
1
vote
2answers
45 views
Unable to call parent controller method from directive
I've seen the many, many, many, many questions on this problem but for some reason I still can't bind ng-click in my directive to a method on the parent controller. I'm pretty sure I've got my scope ...
0
votes
1answer
24 views
Change child scope using broadcast from app.run
I have an angular app with the name DemoProject.
I have an app.run controller and one child controller
JS
var app = angular.module("DemoProject", ['ngRoute', 'ngAnimate', 'ngMessages', ...
0
votes
0answers
18 views
Change Values for an angularJS child Controller property in app.run
I having a angular module app in the name of the ng-app DemoProject.
Now I'm creating app.run controller and one child controller
My AngularJS Script
var app = angular.module("DemoProject", ...
0
votes
2answers
51 views
How to change Selected Tab inside controller in angularjs?
Here I created Sample For Tabs.
What I exactly need is inside sample controller manually I need to set selected tab based on config parameter. At load time I need to set manually the tab to be ...
0
votes
4answers
59 views
console.log for $scope in angualr js
Why I'm not able to console output $scope values ? I'm trying to extract user assigned values from the pages and retrieve in controller. Eventually i would like to pass this to service so multiple ...
1
vote
2answers
29 views
POSTing item from ng-repeat
I have a simple ng-repeat, that displays a list of addresses. Next to each address is a button, when clicked, i want to perform a HTTP:POST. I know know how to perform a REST call, but im struggling ...
0
votes
1answer
25 views
How to do dynamic Helpcontext with anchor scroll in angularjs?
Here I created a sample for a dynamic Help Context. Based on the page it will load dynamic help data which is working fine.
In local $anchorScroll is also working fine.
What I need exactly is while ...
1
vote
1answer
81 views
Scope Variable undefined in angularjs typescript controller class of directive
I have created wrapper directive over ag grid as below
function MyDirective(): ng.IDirective {
var directive = <ng.IDirective>{
restrict: "E",
template: '<div ...
1
vote
1answer
29 views
Argument 'indexController' is not a function, got undefined
This has been asked before but it didn't answer my question. I am pretty new to angular and I am just putting things together at the moment. I am trying to get my factory to work inside my controller. ...
0
votes
0answers
23 views
create multiple jqxwindow with angularjs
I'm beginner in AngularJS and I want to create multiple jqxwindow with AngularJS. How can I do it with Angularjs-directive or AngularJS-controller?
3
votes
3answers
48 views
Difference in controller declaration in AngularJS
I have seen controller being declared in two ways as below. But what diff does this make?
appmodule.controller('Actrl',['$scope',function($scope) {}]);
appmodule.controller('Actrl',function($scope) ...
1
vote
3answers
58 views
How to keep track of current user in angularJS controllers?
factory / service:
angular.module('phoenix-template')
.factory('User', ['$http', function($http){
function current(){
...
0
votes
1answer
23 views
Sending received Rest data in service file to controller angularjs
I am new to angular js and I have a problem sending the received data from my service file to controller, which ultimately binds to my html. Can someone please help me resolve this problem. Thank you.
...
3
votes
2answers
31 views
Error: [ng:areq] customerController not a function got undefined
I am beginner to angularjs and I am writing a simple application to get started with it. I keep getting this error Error: [ng:areq] customerController not a function got undefined
I have tried to ...
0
votes
1answer
40 views
Angularjs directive template = $scope.(some variable from another controller)
This is part of my AngularJS application
.controller('Littlebear',function($scope) {
$scope.spread='<h1>this is the</h1> Littlebear spread.'+
'<img ...
0
votes
1answer
45 views
is it Possible (partial class) concept for controller in angularjs?
Is there any way to do code grouping using partials in angularjs?
Reason --- I have a controller which contains too much code. This controller contains the code For several Methods and a lot of ...