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.
1
vote
3answers
13 views
Trouble with Controllers to manipulate an Object inside a Service
I have an object which should be accessible in many controllers.
This object is inside a Service, has default values and the controller might change those values later.
My problem is that my ...
1
vote
4answers
52 views
Show a div with AngularJS
I am searching how to show a div with AngularJS. I read some topic on StackOverflow but when I try to apply them, it doesn't works for my case...
This is my HTML code :
<div id="myPanel" ...
0
votes
1answer
17 views
How to keep different files for controller and directive which is using that controller
I want to understand if there is any way that I can keep controller and directive which is using this controller in different files?
I have two files, say 1. MyController.js and 2. MyDirective.js.
...
0
votes
2answers
28 views
Is this the correct way of binding factory to controller?
I have the following code in my module:
.controller('ModalInstanceCtrl', function($rootScope, $scope, emailService) {
$scope.emailService = emailService; // Good or not; if not, why?
...
1
vote
4answers
32 views
angularjs app not working after code concatination
I have and angularjs app.I want to concatenate all the JS files to a single file.I'm currently trying to use Grunt.js to setup an automatic build process for concatenating JavaScript files.
However ...
1
vote
1answer
23 views
Angular $watch not working on controller variable updated by directive
I am trying to place a watch on controller variable which gets updated from a directive using function mapping. variable is getting updated and logged in console but watch on it not working.
Code ...
0
votes
1answer
42 views
angularjs - load different controllers/js files based on users' access levels
I'm working on a web app where users have different access levels. Each access level has different sets of controllers/views.
I'm using ngRoute and ng-view. Each controller has its own JS file and it ...
2
votes
1answer
34 views
Using Browserify with Angular JS - - Passing a service into a Controller
As the title suggests I've recently started a new project where I'm using Browserify (and Gulp) to concatenate my Angular JS files (and the Angular sourcefile) into a single file - bundle.js.
I've ...
2
votes
1answer
50 views
why angularjs controller loading twice
Here is my route config, I am using routeProvider to bind controller to view and not declaring ng-controller in my view still my controller loading twice, I searched for lot of solutions and tried ...
1
vote
3answers
27 views
Angular js controller design passing data of http post response to another controller
I am new to Angularjs. I have a question on the design of controllers and sharing of data.
I have the first partial upload.html which uses UploadCntrl for uploading a word document to the server ...
0
votes
2answers
46 views
directive isolate scope data undefined in controller
I have been writing down a module for image gallery, I have got a issue with it, my isolate scope is becoming undefined and does not change its state. I cannot understand the reason for it.
I have ...
0
votes
0answers
21 views
Execute controller asynchronously
I have a controller within another controller in the HTML file. I want to execute both controllers asynchronously as both are not dependent on each other but the HTML structure is like that.
...
1
vote
4answers
41 views
Angular JS: unable to display value
I am a new learner of Angular JS. Please help me to find reason why this demo only display : {{name}} instead of showing each values,
<!DOCTYPE html>
<html>
<head>
...
1
vote
2answers
50 views
Unable to fetch data from controller in multiple html page in angularjs
I am trying to make a webpage.In that when a user login , a new html page("dashboard.html")opens in the view. This "dashboard.html" contains some links(links to other html pages).When user clicks on ...
1
vote
1answer
27 views
Angular directive binding without template controllerAs
I'm encoutering an issue when using a custom directive without template (use Server generated DOM) and binding my view to a controller.
Here is my jsFiddle sample :
angular.module('myModule', ...
2
votes
3answers
53 views
Inserting text into HTML from AngularJS
In my index.html file, I have created a very bare-bones form. I have separated much of the detail into app.js so that if someone wants to have their version of the form look different, they just have ...
1
vote
1answer
27 views
AngularJS Expression not displaying the data from service
I suspect it is an incorrectly written expression or the way the controller is fetching data from the service. By the way, the controller has been tested and it works just fine.
Please help.
Here ...
0
votes
1answer
20 views
$location.search() used with external function reset whole $scope. How to avoid it?
Example of problem: Plunker
Its about controller.js file. I am trying to pass cleanSearchParameters output into $location.search function and it does work, but after whole $scope gets reset.
Check ...
0
votes
1answer
19 views
$location.search() - how to use params from scope inside $scope.$watch function?
I need to pass function variable into $scope and reuse it inside $scope.$watch. I don't know why my whole $scope get resetting all the time in first example.
Living example of my problem:
Plunker
...
0
votes
1answer
52 views
Angular Typescript: Unable to inject $filter in controller
I am using a controller inside my directive. I have declared a function (change(searchAttribute: string)) in controller constructor which will internally use the filter but i am getting runtime ...
0
votes
0answers
24 views
angularjs - test a directive controller
I'm trying to test a directive controller.
Here's the directive code:
angular.module('bars', []).directive('timerBars', function() {
return {
restrict: 'E',
scope: {
timer: '=',
...
0
votes
1answer
39 views
ng-model not working with radio buttons in angular
I have a simple form with radio buttons that pulls values from a server and loops through them to provide radio buttons:
<form ng-submit="createSubCategory(subcategory)">
<div ...
6
votes
2answers
125 views
AngularUI Datepicker disable dates outside of range
I want to limit the Angular UI Datepicker to be between two dates passed in as variables. Preferably I'd like to get it working without adding a library like momentjs, because this is the only field ...
1
vote
1answer
35 views
angularjs show hide based on file extension of file input
Anyone know how to check a file extension on a file input and display a div based on the file type. I need to give different upload option based on the file being uploaded. It text asks for an input ...
1
vote
2answers
35 views
AngularJS: display a block of html after button click
I am trying to write a controller to handle the button click of the "New" button. The goal is for the lower block of code (starting <div ng-show="buttonClick">) to be initially hidden. When ...
0
votes
3answers
49 views
TypeError: $controller is not a function + Controller inside controller
I am new to Angular JS and trying to call a controller inside another controller but getting below error.
ionic.bundle.js:21157 TypeError: $controller is not a function
at new <anonymous> ...
0
votes
0answers
28 views
Why doesn't this angular code / directive seem to be executing?
None of the links are broken. None of the Javascript between the two console.log's seem to be executing. I've been trying to work this out for a while but don't see anything wrong. Any clue ...
1
vote
2answers
70 views
AngularJS controller doesn't work after first refresh page
I'm using AngularJS for my hybrid Ionic app.
My controller:
.controller('SubmitCtrl', function($scope) {
console.log("this just work for only refreshing the page!);
});
Only for each refreshing ...
0
votes
1answer
23 views
$http POST request response returning a JSON object in service, but when called in the Controller it is undefined
So pretty much I have a service that contains functions for making some REST method calls via the $http service in AngularJS. These methods are then being accessed and called in the Controller.
...
2
votes
0answers
38 views
AngularJS Cordova app sometimes cannot find controller
I have this weird error in a Cordova/AngularJS app.
Sometimes (rarely) AngularJS cannot find the controller and chrashes, leaving users with a half-loaded unresponsive view.
The error only seems to ...
0
votes
2answers
55 views
How do I call a controller method from my directive?
How do I call a controller method onDrag() from my directive?
Html / (SVG)
<g ng-controller="EntityController as vm" draggable> ... </g>
Directive
app.directive('draggable', ...
1
vote
2answers
38 views
Issue with angular factory service
I'm trying to get my head round Angular services. I've created a simple example but when I try to utilize the service the console spits out an error (see below)
app.js
var myApp = ...
0
votes
0answers
47 views
Access controller and form names in angular directive
I'm not sure if this is the right approach. I have multiple forms with different controllers and i have one custom directive used by all forms. When user clicks RESET button from either of the form. ...
1
vote
2answers
34 views
How to enable auto watch angularJs?
I'm beginner with angularJs and have, as i think, simple problem with whatching changes in my $scope.
I have an object $scope.tasks which i received from server. It looks like:
{
2: {id: 2, name: ...
4
votes
1answer
57 views
Can I use controller in other controller in angular js?
I'd like to use Angular JS scrollbar to show content.
Here are two controllers I want to use.
module.controller('productsCtrl', function($scope){
$scope.products = [
...
0
votes
0answers
20 views
Angularjs view refresh
I have a template which shows Exercise related data i.e. exercise name, intensity level, description etc. and a button to submit a rating to that particular exercise.
All this data is fetched from ...
1
vote
1answer
70 views
Angular JS TypeError: $http is not a function
I have read through all the posts where people get this issue where $http is not a function, and it looks like for the most part it is due to injections being done in the wrong order.
My module ...
1
vote
2answers
33 views
Update Directive Scope After Controller Service Call
I have a controller, which calls a service that performs a $http.get
app.controller('myController', function ($scope, mService) {
$scope.chair;
myService.getData().then(function (data) {
...
0
votes
3answers
26 views
Angularjs scope length outside function
Im a newbie in AngularJs and do not really know how to get length of response outside function.
var onUsers = function(response){
$scope.users = response.data;
...
1
vote
2answers
37 views
Error: [ng:areq] Argument 'ControllerName' is not a function, got undefined
In app.js I have:
(function(){
var app = angular.module("myApp", []);
})();
in process.js which is included after app.js I have:
(function(){
app.controller('ProcessController', ['$http', ...
0
votes
1answer
53 views
when should i use more than one controller in my app?
So recently I started to learn angularJS and I'm working on a SPA project.
it is a game with several steps (the purpose of the game isn't important for the matter of the question)
At the moment i ...
0
votes
1answer
53 views
AngularJS: Image upload + FileReader preview. Trouble binding between controller, directive and scope
I'm relatively new to Angular and are stilling trying to wrap my head around all it's magic and scoping.
I'm trying to do a simple image upload with preview script and I'm missing the final piece.
I ...
0
votes
1answer
29 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
1answer
22 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
55 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
48 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?
3
votes
1answer
96 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
124 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
31 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
146 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: ...