Dark mode beta

You’ve been asking for dark mode for years.
The dark mode beta is finally here.

Change your preferences any time.

All Questions

Filter by
Sorted by
Tagged with
8
votes
3answers
15k views

Using controller inside another controller in AngularJS

Why I can't bind to controller's variable inside second controller? <div ng-app="ManagerApp"> <div ng-controller="MainCtrl"> Main: <div ng-repeat="state in states"&...
5
votes
2answers
2k views

Using this instead of $scope inside controller

I am trying to follow style guide for angular and there wrote we should use this insted scope... Styleguide Could someone explain me when I am able to use this? Here is my try..... What I am doing ...
4
votes
1answer
2k 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"> &...
4
votes
2answers
357 views

How to remove Cordova specific events outside Angular controller?

Imagine I have a controller which handles, for example, view changes: function Controller($scope){ var viewModel = this; viewModel.goBack= function(){ viewModel.visible = visibleLinks....
3
votes
2answers
442 views

AngularJS ControllerAs syntax and controller injected variables

I'm writing a directive and trying to stick to the John Papa style guide. So I've also decided to jump on the ControllerAs syntax wagon and I've got a tiny directive like below: (function() { ...
2
votes
1answer
51 views

Why are my controllers methods not available?

after a long time I have to concentrate an angular again. But I fail... ... ng-repeat="n in DataController.getObjects" myApp.controller('DataController', [function () { console.log('test 1'); ...
2
votes
1answer
223 views

Using ng-options for select when using as notation for controller

I have a select using ng-options to define the options which works fine when I use just the controller name within the ng-controller directive. The problem is that when I add "as options" to the ng-...
1
vote
2answers
102 views

What is the issue with this sample code in Angular Js

I am learning angularJS. I have tried a calculator using angularJS. Two combo boxes having inputs and the other combo box is having the operations. When the user clicks the button then it has to show ...
1
vote
1answer
2k views

Import JSON data for AngularJS Web App

I have been following the Angular tutorials, and I am trying to get my JSON data to appear, yet I know I am doing something wrong, but can't figure out the proper method. I know that somewhere in my ...
1
vote
1answer
171 views

AngularJS ng-click function not reached

When I'm adding new product to a product list its not working. So the products get loaded well but the ng-click function does not getting called. (The alert I put in the addProduct function is not ...
1
vote
1answer
3k views

Angular form validation using the controllerAs syntax

I am currently facing the following problem: I would like to validate my form input using the Angular ngModel directives. When using those together with $scope they work fine. Now, working with the ...
1
vote
1answer
764 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> ...
1
vote
3answers
408 views

Ng-Click not firing

whenever I click my submit button nothing happens, currently all I want it to do is print out the username and password to test there bindings. And I am able to talk to the controller and print out ...
1
vote
2answers
487 views

AngularJS - Data is not populating in table while using http service

I have a Web API which retrieves list of employees. Now when I call to $http service, I can get data from WebApi but it neither populated in table nor gives any error. Note: I am using angular v1.5....
1
vote
3answers
177 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) { ...
1
vote
1answer
41 views

Binding issue in AngularJS

I am trying to bind from a http get request. The http get is returning true or false. I have tested the get and it is returning properly. When I run the code below, it shows the alert(1111) ...
1
vote
2answers
134 views

updating variable in http request callback in angular

This is probably easy but nevertheless. I have a http call in my controller where I load a json file. I want to update a variable in my html based on a result. It updates apparently the variable (...
1
vote
1answer
148 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
1k views

Angular: directive with bindToController 'loses' data

I have actionButtons directive: function actionButtons(){ 'use strict'; return { scope: {}, restrict: 'AE', bindToController: { itemId: '@', ...
0
votes
2answers
57 views

why is this controller instantiated only once?

I have the following (also in Plunker): <!doctype html> <html <head> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular.min.js"></script> &...
0
votes
1answer
52 views

Angular Structure Incorrect Somewhere

All i am trying to do is call my back-end through an ng-Click and $http.get. I am then trying to set the value of the item i get to show up in my html. Here is my structure. Not really getting any ...
0
votes
1answer
695 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', [])...
0
votes
1answer
36 views

Angular controller functions are both constructors and a decorators?

If one writes a controller as ctrl for the following code: function Controller($scope) { $scope.abc = "123"; } angularApp.controller("controller", Controller); Does the pseudo code below ...
0
votes
1answer
71 views

How to inject a controller as a dependency when using Controller As notation?

I have a controller that depends on another controller (for settings info). I'm trying to use the Controller As pattern but I get an injection error. Here's my controllers: angular.module('app2', [])...
0
votes
0answers
193 views

Angular 1.5 component doesn't call parent controller method

I'm using angular 1.5 component and I want to call controller's method which is bind to scope from component's method call. Please find below code <table-pagination previous="getPageName()"><...
-1
votes
2answers
164 views

What is key benefits of using controllerAS in angularJS

ng-controller="invoiceController as invoice" create new invoiceController constructor and assigned the same to scope behind the scene, which the similar thing $scope injection does in controller ...