Tagged Questions
2
votes
1answer
41 views
how to store same data in multiple $scope variables in same controller using angularjs
I have to store same data in two different scope variables. I have saved as per below code.
app.controller('ClientsCtrl', function ($scope, $http) {
$scope.model = {};
$http.get(...
1
vote
0answers
77 views
AngularJS multi screen validation on last step
I have an angularJS application. I have implemented a generic workflow using $routeProvider, templateUrl & Controllers.
Each step(screen) is verified when user click on next button and moves to ...
2
votes
2answers
43 views
Angularjs 1.4.4: Uncaught ReferenceError: $rootScope is not defined
I want to use SockJs to receive all the events published by stomp from the server side. I have created WebSocketController. It is initiated in app.js as
.controller('webSocketController', ...
0
votes
1answer
17 views
not able modify array object of parent controller in model controller in angularjs 1
I have done the following :
var appController = function ($scope,$uibModal) {
$scope.list = [
{
"parentId": 0,
"id": 1,
"title": "node1",
"description": "test",
"canhaveItems": true,
"...
0
votes
0answers
37 views
Cross Directive Functional Binding in Angular 1.5
In an angular 1.5 application, both directive are independent inside same application
A demo of the situation shows here
https://codepen.io/adamchenwei/pen/qXRGQp
You will see an error where in ...
-1
votes
1answer
47 views
Using directive way to build up a form with some input values
I am trying to get some input fields which collect the info after clicking the submit button using directive method and pass these values as arguments to a function. This is my code which doesn't work
...
0
votes
0answers
105 views
where does the 'ng-model' directive store the data?..I am not able to access it inside a controller
Please help me to get the data from text box to a controller without embedding controller inside element
<html ng-app="mymod">
<head>
<script
src="https://ajax.googleapis.com/...
1
vote
1answer
3k views
How to handle multiple forms present in a single page using AngularJS
I am a newbie in AngularJS. I am having multiple forms on a single page which gets displayed based on the user selection only one at a time.
The DOM has two child controllers namely ...
0
votes
0answers
172 views
Angular.js + ui-router wrong controller
I'm using angular 1.6.1 and angular-ui-router 0.3.2.
I have basic routes set-up as follow:
{
state: 'home',
config: {
url: '/home',
templateUrl: '...',
title: 'home'
}
},
{
state:...
0
votes
3answers
54 views
Why do I need a $watch when using function in controller in combination with a directive
I know and can imagine why I need the commented lines of code to let this work. But I can't found the technical reason. Why is the field not update when you click on the button? (the $watch fixed the ...
0
votes
2answers
183 views
Data share between directive and controller in AngularJS
I need to take a step back and understand the data flow between controllers to directive, directive to controller and the inline template vs template url in directives.
I have customDirective ...
1
vote
2answers
410 views
AngularJS - Factory variable doesn't update in controller
I'm facing a new issue with AngularJS.
Infact, since I need to have a "shared" variable, readable and updatable in 2 controllers, I thought about doing that with a factory injected in both the ...
1
vote
2answers
627 views
Why will always use anonymous function in AngularJS
I see almost tutorial use anonymous function in AngularJS, instead of normal function, like function name(para1) {}. Please see this link: http://www.w3schools.com/angular/tryit.asp?filename=...
0
votes
0answers
120 views
angularjs ng-repeat autonumber increment from multiple arrays
I have this ng-repeat:
<div ng-repeat="prop in props">
<div ng-repeat="tenant in prop.Tenants">
<label class="col-md-6 control-label">Tenant {{$index?}} ({{tenant....
0
votes
2answers
94 views
Hiding navbar based on current path with AngularJS ($scope vs. controller as syntax)
I'm working with the Inspinia Admin Theme (AngularJS Version) and have the following Problem.
I'm trying to show or hide the navbar based on the current path. The Problem with my first approach (...
1
vote
1answer
336 views
Interpolation in Angular JS
I am trying to understand Interpolation concepts in Angular JS and I have written this code. I am trying to enter a text in input box and based on the template in text area tag it should replace the ...
1
vote
0answers
16 views
AngularJs how to access attributes of objects with numbers in its name? [duplicate]
I have an issue to access object property that has numbers in it's name , below sample code is a response of Pinterest API , i can access each property except the images URL . error raised because of ...
2
votes
3answers
49 views
AngularJS multiple Scope needed for Autocomplete
I have an array structure like this.
[
{
"id": "1",
"name": "John",
"city": "NY"
},
{
"id": "2",
"name": "Gerold",
"city": "LA"
},
{
"id": "3",
"name": "...
1
vote
3answers
609 views
AngularJs: How to initialize the value for function Which is returning NaN?
I had a problem on my code in angularJs function which is return NaN instead of 0 during initialization.
Sample Code is Here
var app = angular.module('myApp', []);
app.controller('personCtrl', ...
0
votes
3answers
182 views
AngularJS, calculation addition (+) is not working
I tried to calculate $scope values through angular controller. For instance: the below code works in order to multiply values inside brackets. However, addition(+) is working like 400+200 = 400200. ...
0
votes
3answers
1k views
How to add a progress bar in ionic app
I really need your help, I am new to ionic project. Currently working on a project. This app pulls blog post from wordpress using $http. How can I add a progress bar to tell the users that the page is ...
0
votes
1answer
50 views
AngularJS Controllers
Recently faced angularjs controller behaviour. Someone accidently from team did structured DOM like this : -
<div ng-controller="firstController">
<div ng-controller="secondController">
...
0
votes
2answers
83 views
Does controllerAs work with Isolated Scope?
I'm familiar with using controllerAs, but do not understand why, when using with isolated scope, none of my controller properties are showing up on the scope.
Here's a plunker showing what I'm ...
0
votes
1answer
273 views
Load image using AngularJs
I have create a simple web site using angularjs and bootstrap.
In one page, I load a static image and I set some botton on this using bootbox.
When I run in local my site using
grunt serve
I see ...
0
votes
1answer
54 views
Passing Data from Service to Template via Controller and $stateParams
I have a service with the following code:
.service('ChatService', function() {
return { //Gets Data from controller
sendData: function(data) {
this.chatData = data;
console.log('...
1
vote
1answer
108 views
Firing event from dynamically opened controller to parent controller in Angular js
I am developing an Web Application using Angular JS. I am new to Angular JS. in my app I am using bootstrap.ui JS for Angular js. But I am having a problem with bootstrap modal controller. I open the ...
0
votes
1answer
40 views
Pass Data to Service from Controller AFTER receiving info from Server
I need to pass data to an array in service after getting from server. The controller runs the function to retrieve data as shown
.controller("messagesController", function($scope, $stateParams, ...
1
vote
1answer
48 views
Picture won't display as part of my little angularjs app
I wrote a little app that converts Fahrenheit to Celsius and I want a picture to display based on the Fahrenheit temperature. I can't get the picture to display. Can someone tell me where I'm going ...
0
votes
1answer
243 views
Retrieving model values from dynamically opened controller's scope in AngularJS
I am developing an Web Application using Angular JS. I am a beginner to AngularJS. In my app, I need to dynamically add and remove elements. I use directive for it. Adding and removing elements is ...
0
votes
2answers
126 views
Controller data not passed to directive
I started looking into angular and cannot seem to figure out why my data is not passed to my directive. I have code here: https://plnkr.co/edit/ONwYevQ4NbvBVjTwARHl?p=preview
My Code:
app.js:
var ...
0
votes
2answers
66 views
Angularjs - How can editable data be shared between run, factory and controller blocks?
tl;dr - app.run resets $rootScope.variable's value every time I invoke an API - I need help finding a way around that.
I have an AngularJS + ASP.NET Web API setup. I need AngularJS to send a token in ...
0
votes
2answers
4k views
angularjs controller access directive scope value
I have this controller with directive inside my html code. The directive have scope value I would like access from the parent controller and show in the html. Hope my example code give you a simple ...
1
vote
1answer
566 views
Getting error when pass data between controllers using sample service
as part of angular js learning, i created small app that will pass the data between two controllers using services..below is my code to pass the data between two controllers..
Controller code
<!...
0
votes
0answers
679 views
Removing a AngularJS component from the DOM and from his parent on click
i'm trying to show a list of users in AngularJS
Each one would be user with a custom component element
The components would have TWO buttons
First one have to remove the component element from the ...
0
votes
3answers
279 views
How to isolate child controller scope from parent controller scope without changing the view?
Click on the parent button change also child but child button not.
I need to change this behavior isolating scopes whith any hacks or other way.
Child controller doesn't inherit from parent ...
1
vote
2answers
327 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....
2
votes
2answers
64 views
share data between controllers getting/setting data asynchronously from a service - AngularJS
I'm having trouble with getting my custom angular service to work.
My service is as follows:
app.service('userService', function(){
var user = [];
var setUser = function(newObj){
user.push(...
0
votes
1answer
170 views
Argument 'myController' is not a function, got undefined
I'm trying to setup some controllers in my angular app but I'm not sure why I can't make them working, since I think I'm using similar approach as I've done before.
I declared app.js file:
'use ...
5
votes
1answer
18k views
AngularJs: Binding ng-model to a list of radio buttons
Im trying to bind the selected value in a list of radio buttons to an ng-model
I have:
<!DOCTYPE html>
<html ng-app="testApp">
<head>
<script src="./...
0
votes
1answer
232 views
get scope from a certain controller in angularjs
I try to test my angularjs app through QUnit framework.
On the page mysite.ru/#/unittest/ - I use a controller called UnittestCtrl. But in my app I have a DetailCtrl and other page that I want to test....
0
votes
1answer
1k views
using $http in component module angular JS
I'd like to understand why i can't retrieve data from external sources.
I need to recover the content of a Json and parse it to display content in this template :
Nombre of news: {{new.length}}
<...
0
votes
2answers
99 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?
$scope....
1
vote
1answer
563 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 ...
1
vote
4answers
82 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>
&...
0
votes
1answer
28 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
38 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
...
1
vote
2answers
961 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 "New"...
0
votes
3answers
684 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
1answer
744 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.
...
0
votes
2answers
234 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', ['$...