Tagged Questions
0
votes
1answer
16 views
Directive talks to controller but cannot call functions residing in controller
I have a directive which needs to call functions from the Main controller but everytime i try to reference a function inside the directive nothing happens because it's undefined. When I access a value ...
1
vote
1answer
12 views
Isolating re-used controller scopes with AngularJS
I'm currently working on a project where I use a primary navigation to open tabs which lazy-load templates.
EDIT: to clarify, the number of tabs can vary on a user basis, so I cannot do this hard ...
0
votes
1answer
20 views
Enable and Disable other items in ng-repeat with Angularjs
I have a list of user in my controller .
var app = angular.module('app',[]).controller('userList',function($scope){
$scope.users = [
{name:'A',family:'B'},
{name:'C',family:'D'},
...
0
votes
2answers
27 views
AngularJS Populating input field with directive but not captured in $scope
When I populate an input field from within a directive, it shows on the DOM, but $scope is not capturing the value. How do I fix it so that $scope captures the new info?
How to reproduce the ...
0
votes
0answers
20 views
Testing promises with angularjs order of execution confusion
I'm testing a promise with angularjs jasmine, and sinonjs.
I'm puzzled by something regarding promises. Here is my code:
it('should return data with length 4 ', inject(function ($rootScope) {
...
1
vote
2answers
16 views
AngularJS: Recommendation on rendering different view when HTTP 404
What I am doing
I am trying to create a service which loads the user budgets for current month. The code looks like
$scope.thisMonthBudgetSummary = function () {
console.log('retrieving ...
0
votes
1answer
21 views
Using Helper in AngularJS
I am working on an Social app using laravel and angularjs.
I have a situation where when i check for user relation using helper.
**Html**
//showing users other info
<div ...
1
vote
2answers
39 views
Why i can not get the update value in an AngularJs factory?
I am trying to update and then get the update value of an AngularJs factory, I am setting the value in one scope and trying to get it in another, I am setting a factory to handle the pop up messages ...
0
votes
2answers
40 views
generic functionality wrapped as a directive
I am attempting to write a directive that will sort arbitrary data at an arbitrary place in my application. Let us say I have the following code (based on actual real code, sort function and some of ...
1
vote
1answer
22 views
Directive - getting values from views -scope “@”
I am trying to make a button, which changes its styles every time it's clicked.
The console keeps making errors - 'initial' is not defined. I've been trying to figure out why but so far no luck.
...
1
vote
2answers
20 views
Re-rendering entire ng-repeat
I'm unable to re-render ng-repeat. The ng-repeat is connected to a scope variable, which I'm trying to change using an ng-click. The value of the variable is changing on ng-click, but the ng-repeat is ...
1
vote
1answer
22 views
No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access.
I have created an API in Django, and some plain files from the desktop for angular and html. I like to fill an angular app with the API output. The request reaches the webserver, but then i get an ...
0
votes
0answers
13 views
Append element using angular after a specific action
I have a directive which $watches for changes I want to fire a success message after that
so suppose my element is tr . Appending the following code wit the after function does what's needed but it ...
0
votes
1answer
27 views
Set scope from service data and watch it
I am just looking for best solution to do this is angular. I get all users data in scope users from a service callback.
Js
App.factory('service',function($scope,$http){
return{
...
1
vote
3answers
24 views
Angular get to JSON file displaying as empty
I am new to angular and trying to integrate it within my application. I am attempting to use a simple $http.get to a .JSON file, which seems to be found, but when trying to pass the data to the front ...
1
vote
0answers
28 views
element directive cannot display on page when call from other directive
I am getting a problem while calling colors element directive in draggable directive. when i call colors directive it add "" string in html. I want a select element populated with colors array ...
0
votes
1answer
17 views
Angularjs Select initial value for selectbox inside ng-repeat
I want to populate the selected color as selected option in selectbox in initially
link of jsfiddle
here is my partial :
<div ng-app ng-controller="QuestionController">
<ul ...
0
votes
1answer
41 views
TypeError: Cannot read property 'push' of undefined
I'm trying to push the 'currentBall' object into the 'currentOver.balls' array
$scope.currentOver.balls.push($scope.currentBall);
The current state of both objects just before the above code is ...
1
vote
1answer
54 views
Passing variables from one controller to another with $rootscope
I'm trying to pass the id from one controller onto the next using $rootscope. I thought it was as simple as setting the variable to $rootscope, but for some reason when i check in console it comes up ...
0
votes
1answer
13 views
AngularJS - Does using the same controller in a hierarchy use separate scope
When you use the same controller as below in a DOM Hierarchy, does each controller gave its own scope/state?
<div ng-controller="EventController">
Root scope <tt>MyEvent</tt> ...
0
votes
1answer
31 views
I am able to query my api call, but i am not able to show it via angular
I have made an JSON api. I like to query this with angular.js. On my webserver i see the request comes in, and returns a status 200, so the data are called by angular. For some reason however, i am ...
0
votes
1answer
21 views
Watch expression does not work in modal included
i just want to make work a watch expression into a modal , which is included in a html file .
Into my demo, there are 2 watches : one works and the other no.
http://plnkr.co/edit/bNF7Yw?p=info
...
1
vote
1answer
33 views
AngularJS Factory loading data on each click
Plunker
There are a lot of files, so perhaps you Angular aficionados will understand my explanation, or be able to follow the plunker I've provided above.
I'm creating a demo to modularize a ...
0
votes
0answers
16 views
how to code to get the file to open in pdf format in angularjs
Hi I am really new to angular and trying new stuff.
I have a button which says download pdf and on clicking this the file should open in the new window in pdf format.
How can this be achieved the ...
0
votes
2answers
30 views
Angular and JSON syntax getting confused with {}
I am new to angular and trying to integrate it within my application. I am attempting to use a simple ng-repeat (which works perfectly in an example project i setup). However, in the current project, ...
0
votes
1answer
22 views
make div hide if clicked elsewhere AngularJs
I have a question , how we can achieve this with angularjs.
## Html ##
<input ng-model="text" ng-change= "datashow(text)">
<div ng-show="showit" ng-init="showit = false">
//contains ...
-5
votes
1answer
33 views
how to add selected value of drop down list item value stored in html table in angularjs [on hold]
Please give me sample program with work out in plunker. My code is
function List($scope){
$scope.list_array=[
{number:1,name:'A'},
...
1
vote
1answer
17 views
what will be the scope of scope variable in link function in angular?
var $directive = angular.module('myApp', []);
$directive.directive('myDirective', function(){
return {
restrict: 'E',
template: '<h4>{{title}}</h4>'
compile: ...
0
votes
1answer
13 views
Post request is not working in angularjs - Resource services
I'm trying to send the post request to server with post data
it's sent the request to the server, but not in right format
request url like ...
1
vote
1answer
19 views
Keeping track of UI State in an angularJS app
Intro:
I'm working on a web app using ui-router, and using nested views/controllers. There are several UI elements across the app that need to communicate, and who's actions may be dependent on ...
1
vote
2answers
30 views
Pass argument from controller to service in angularjs
I'm facing the problem on passing the argument from controller to service module
I don't know where I have pass the arguments in controller module and how to get the value in service module. here is ...
3
votes
2answers
42 views
How to call a directive from an another directive in AngularJS?
I have just started using AngularJS. Is there a way to use a directive from an another directive ?
I would like to add new <div time></div> on click on the parent.
EDIT : index.html
...
0
votes
0answers
21 views
Angularjs Separating Directives from Controller files into own modules [closed]
I am new to AngularJS and recently introduced it into my application. I am trying to modularize my code specifically taking my directives out of my controller.js files and into their own directives.js ...
0
votes
2answers
27 views
angularjs if/else statement and window width
I am new to AngularJS and recently introduced it into my application. I am trying to re-write some of my existing jQuery code in my controllers, however, on one occasion, i am using:
jQuery:
if ...
2
votes
1answer
32 views
Angular. Generate directive inside directive. Where is my scope stuff?
I am trying to generate multiple expressionSelect directives inside my expressionAuthoring directive, in this case, on a simple click. I can get the expressionSelect template to appear, but with none ...
0
votes
1answer
42 views
AutoComplete using ngTagsInput Cannot Read Property 'then' of undefined
I am trying to figure out this problem but I am having no luck.
This is the plunker I wrote that works. Notice that the code works perfectly when I am accessing tags.json using a $http.get.
Angular ...
1
vote
3answers
50 views
Update AngularJS scope variables in the view
I have the following AngularJS controller function which makes a JSONP request to a webservice, gets the data as a JSON file and assigns the values to scope variables which I show in the UI by ...
0
votes
0answers
16 views
AngularJS access variable in newly created DOM
I have the following DOM created in the link function
var ngStyle = "'background-color' : '#' + ghost.backgroundColor," +
"'margin-top' : ghost.marginTop + 'px'," +
...
0
votes
2answers
27 views
AngularJS directive dynamic templates
Sorry, maybe it's stupid question but i'm still learning.
I'm trying to make directive with differtent templates based on scope value.
This is what i done so far which i don't know why doesn't work ...
1
vote
3answers
38 views
Scope variable not accessible (undefined) - AngularJS
I am setting a scope variable in one controller, then changing location to another view. Then in the controller of the new view the scope variable is no longer accessible, it states it is 'undefined'.
...
0
votes
1answer
11 views
All values in array bound to same value
I'm trying to update values inside $scope.match.teams[0] with vaules for the players' names, but when I input in a single field, it is bound to every players' name for that team.
Controller:
...
0
votes
1answer
19 views
Reset a $rootScope property on location change in Angular.js
in my application I have a $rootScope property called $rootScope.currentStatus used to set a css class on body under some circumstances.
The problem is that I need to reset the value to a default any ...
0
votes
1answer
23 views
Angularjs directive isolated scope and impact in the parent scope
There is a behaviour with isolated scope in directives and = attribute I don't understand.
I have a directive with an isolated scope and two attributes in it :
scope: {
attr1: '=',
attr2: ...
1
vote
3answers
43 views
Best practice for defining scope variables
I have this form. This form contains many many inputs like first name, last name, job title, notes, state, department, documents, supervisor...and so on
Originally I had a controller like so
...
1
vote
1answer
29 views
Directives isolated scope not working properly together with nested views? (AngularJS / UI Router)
I'm using ui-router in a AngularJS project where I have a nested view that contains a custom directive.
This directive renders an input field (lets say a filter-field) and its value should be in sync ...
0
votes
3answers
23 views
Variable in Angular http jsonp config
I am using http.jsonp to make cross domain calls and everything works fine, My config object is as below:
var config = {
params: {
action: "query",
prop: ...
1
vote
1answer
27 views
AngularJS passing JSON object to directive
I'm getting json file from REST server using factory:
.factory('chartData', function($http){
return {
get: function() {
return $http.get('http://').then(function(result) {
...
2
votes
2answers
35 views
AngularJS - how to set up $watch on multiple values
I need to watch on model changes in an object that sits in the controller. The object has multiple values:
$scope.myModel = {
first: 1,
second: 1,
third: 1
}
I want to catch changes to any ...
0
votes
2answers
35 views
Transclusion and scopes in angular: Why is this not working?
I have a very simple setup:
<pane title="mytitle">Title in parent (transcluded): {{title}}</pane>
and
angular.module('transclude', [])
.directive('pane', function(){
return {
...
0
votes
1answer
41 views
AngularJS templateUrl vs template - isolate scope
I have the following directive:
offerListSorters.directive('offersSorter', ['myState', '$templateCache', function (myState, $templateCache){
return {
scope: {},
controller: function($scope, ...