Tagged Questions
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.
0
votes
1answer
18 views
SimpleController Issue
Can't get SimpleController to read correctly, is there anything I am doing wrong or is this an environment issue?
When I was using ng-init the code was working fine, now not registering at all. I've ...
0
votes
0answers
31 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
1answer
37 views
Extend angular Controller
In the current project that I'm working, I have a controller which takes care of operations made on a Grid. Like delete Edit add new row initialize validation and so on. Every thing was fine at the ...
0
votes
1answer
39 views
How directives are invoked If an element that contains a directive is added dynamically through an angular controller?
After doing some search I haven't found much information in this bad practice. Let's say I have a controller that behaves like that (I know it should have been a directive and that in controllers we ...
1
vote
1answer
38 views
ControllerAs not working
I am trying to follow best practise and switch to ControllerAs. In this case I am attaching the controller using ui-router. I have a SPA with two views and one works fine, but the other does not.
...
0
votes
1answer
24 views
Splitting up the directive's controller into smaller parts
So I've made this Plunker that works well as a demo: http://plnkr.co/edit/Zm9d6zHhrnqDlnJsSZ1I?p=preview . It's a simple pagination with two attribute arguments that holds the model-state and some ...
0
votes
0answers
16 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
15 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 ...
1
vote
3answers
50 views
Call angular controller's method from outside
Here's the code: http://jsbin.com/rucatemujape/1/edit?html,js,console,output
My question is how do I manually call method changeUser from JavaScript so the output HTML changes?
I can do this by ...
1
vote
2answers
16 views
Angular controller test on scope.variable is undefined
I'm trying to learn angular unit test with $resource.
Here I have a simple controller :
.controller('DictionaryCtrl', function ($scope, DictionaryService) {
$scope.jSearchDictionary = function () ...
2
votes
2answers
32 views
Calling a controller from a directive with input in angular.js
I'm learning angular by making a browser-based Sudoku solver. There are many ways to solve my problem, but I'm looking for the most angular way to do it.
My html creates a 9x9 grid of text inputs, ...
0
votes
1answer
29 views
angularjs controller not executing sequentially when using asynchronous service
I'm having trouble figuring out a way to use local variables in a controller that contains an asynchronous call. Is there a way to force the controller to run [at least some of] the code sequentially?
...
0
votes
2answers
42 views
AngularJS: Bind angular service property to scope
Scenario
I have a service UserService that maintains the (boolean) sessionStatus of the user.
The view conditionally shows [LOGOUT] on ng-show=sessionStatus (i.e. if not logged in (false), no show). ...
0
votes
0answers
31 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
1answer
47 views
How to pass special characters in a function
I am fairly new to angular, I am working on a POC of how to use modal in my application. Here is what I am doing:
I have controller which declares a function called open in the scope. The function ...
1
vote
4answers
34 views
Factory has two methods, one is $http method with $promise - how to reference the other method from within the first one's success function?
In one of my factories I need to set a variable when data is fetched (through $http) so I can access it in my controller (the intention is to display a spinner image until the data is loaded).
...
0
votes
0answers
39 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 ...
-2
votes
0answers
24 views
Angularjs - sending data using https in angularjs
I am developing an mobile hybrid application using angular js-phonegap. I want to make a post call using https. is angularjs supporting https?
0
votes
1answer
33 views
Angular UI Router pausing before child state controller execution
I know that a child state / controller can wait for needed async results by adding a promise object to the the resolve object in its state description object. But using this means that the decision of ...
0
votes
1answer
12 views
Iterating through an Array with Controller As Syntax -AngularJS
I am currently have trouble displaying my array using the "Controller as" syntax if I pass the $scope in to my controller it works fine but using the "Controller as" syntax and this. My array does not ...
0
votes
3answers
27 views
How to access an object attribute inside a service in AngularJS?
I have a service with a local variable object with events names:
myApp.service('appService', ['$rootScope', function ($rootScope) {
var events = {
firstEvent: "MyFirstEvent",
...
0
votes
0answers
28 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
1answer
28 views
angularjs - accessing a factory from a controller in another module
This is the factory code under the myApp module
angular.module('myApp')
.factory('userFactory', ['$http', function ($http) {
var userFactory = {};
userFactory.login ...
0
votes
5answers
40 views
Data Binding not working in AngularJS
Im now to AngularJs and i've created a test app. I'm using version 1.3.x and i have faced this problem. Here is the code for HtML and JS
var angular.module('ControllerExample', ...
1
vote
2answers
64 views
+100
How do i acces ngRoute's controller from directive?
I need acces to my controller that's provided by ngRoute in directive. Is it possible? Thank you in advance!
0
votes
1answer
39 views
How to run a directive after the dom finished rendering in Angularjs
I'm try to render the template dynamiclly, How to run the directive after {{tag}} has been rendered finished ?
directive:
angular.module('services', [])
.directive('demo', function() {
...
0
votes
1answer
60 views
Duplicate controller when using angularjs
I'm usnig AngularJs 1.2.25. I have a route config:
$routeProvider.when(
'/config-root',
{
templateUrl: configRootTemplate,
controller: "ClientConfig",
}
).when(
...
0
votes
1answer
43 views
Why controller doesn't respond on route update?
I would like preserve instance of controller without reloading. I set reloadOnSearch to false and I manage route change in my controller. Here is the code.
This is example of my link <a ...
0
votes
2answers
53 views
AngularJS: Bind a Service Variable to a Value on a Controller's $scope
I am creating a single-page AngularJS web app. My app needs to be able to query a backend service to get some information about a user's state, and this state information needs to be available to the ...
2
votes
2answers
45 views
passing params from controller to service in angularjs
I'm having trouble on figuring out how to pass parameters from my angular controller to
service
#my controller
'use strict';
angular.module('recipeapp')
.controller('recipeCtrl', ['$scope', ...
0
votes
1answer
47 views
Angular JS. set ng-model correctly on repeatable select directive
Just started learning AngularJS.
I wrote this controller and directive to repeat a select form item, because I need to do some server side work to populate its options.
Here is the directive in HTML:
...
0
votes
1answer
23 views
AngularJS Disabling Forms When Controllers are Created
AngularJS disables (cannot submit) forms that do not have a specific action set:
<form action="">
when you create a controller. It does not have this issue when creating directive or ...
2
votes
2answers
44 views
Variable updated in controller but not updated in HTML?
I'm trying to get a better handle on Angular.js.
As stated in the title, I have a variable in a controller which changes values when called by a member function, however the update is not pushed to ...
0
votes
0answers
43 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
1answer
28 views
angular form name from inside associated controller
I'm very new to angular!! What i'm trying to do is get the form name from inside the associated controller or a reference to the form object from inside the controller.
<form name="someName" ...
-1
votes
1answer
47 views
Confusion about data usage in Controllers
How can I use the fetched data in customersController in AnotherCustomersController
function customersController($scope, $http) {
$http.get("http://www.w3schools.com//website/Customers_JSON.php")
...
0
votes
3answers
33 views
Dynamically specify the controller to use in an Angular directive
I am looking to specify the controller that a directive should use via an attribute on the element - i.e. dynamically:
HTML
<div data-mydirective data-ctrl="DynController"></div>
...
1
vote
1answer
47 views
Directive does not have access to controller function (AngularJS)
When I declare a directive to use that accesses a controller function, it cannot find the controller.
Here is my directive declared in app.js:
app.directive("delete", function() {
return {
...
0
votes
1answer
17 views
When use module to register controllers
I have two functional code to register controller with Angular.
The first code is:
In app.js:
var app = angular.module('myapp', ['...']);
app.config(...
$stateProvider
.state('first', {
...
0
votes
3answers
87 views
angularjs controller function is not getting executed
I have a controller for login and I am not sure why the function within the loginController is not being executed. When I debug thru Chrome, I can see that it is executing line (var controllerId = ...
0
votes
1answer
59 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 ...
-1
votes
1answer
37 views
How to use a function defined in a controller in another controller in angularjs
I have 2 controllers, loginCtrl and regCtrl, there is a function inside the login controller $scope.login and i want to call this function from inside my regCtrl.
What i am trying to achieve is to ...
0
votes
3answers
51 views
AngularJs - Pass Values from view to controller then to service
I have looked at similar questions, but all don't make sense.
I have we api that i am going to use to login people. They provide the username and password, and then i query the api which returns data ...
1
vote
1answer
36 views
AngularJS Modules and External Controllers
I have a page containing multiple containers. Each container will have its own controller but point to one factory, which handles all the logic interacting with a web service API. I would like to have ...
3
votes
4answers
168 views
How to update a form controller in AngularJS after changing input constraints
I have been recently working on dynamically changing constraints on input fields on a form. The aim was to make a back-end-driven form, whereas all fields and their constraints are being sent to us by ...
2
votes
1answer
40 views
Why can't I inject a controller into a controller?
My application has a multi-tab order wizard. It has one Controller called OrderController. I decided I wanted to have one controller per tab, and for OrderController to manage all the tabs and ...
0
votes
0answers
28 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
1answer
146 views
Angularjs Typescript Controller Inheritance and Dependency Injection
I am trying to create a set of Controller classes which are derived from a base class that have many dependencies. Every time I want to create a derived class I have to copy the base class constructor ...
1
vote
1answer
32 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 ...
0
votes
2answers
89 views
Start/Stop/Resume all in one button with Angular Timer
Using the pre-built "Angular Timer" directives available here (scroll down to progress bar example), I'm trying to build a progress bar with a Start, Stop and Resume button all-in-one.
Examples on ...