Tagged Questions
-2
votes
2answers
22 views
“Object doesn't support property or method 'push'” [duplicate]
I'm trying to add new value into existing JSON object in AngularJS but I'm getting this error message:
"Object doesn't support property or method 'push'"
Here is my code:
$scope.addStatus = ...
0
votes
0answers
8 views
Angular computed observable on child object
Im trying to make a small test with angular but got some problems I cant get it to work
How do I make an observable in a child object in angular?
The problem with this code is that when I load a saved ...
0
votes
1answer
20 views
difference between '@' and '=' when testing directives
I'm trying to get my head around testing directives at the moment and have come across some strange behaviour. My code is as follows:
angular.module('tddApp', [])
.directive('oddsButton', function ...
0
votes
2answers
26 views
AngularJS custom table directive
I have made a table with AngularJS all is working good pagination and sorting but i want to make it as a component so that in other pages it can be used. Right now i have made a factory which calls my ...
0
votes
1answer
19 views
AngularJS dynamic Tables and ng-repeat
I am trying to answer my own unanswered question but stuck with some weird results of my code that I can't figure out.
When I generate the whole table by entering common heights and floor numbers and ...
0
votes
1answer
15 views
Defined function not being called
I have a form
<form role="form" name="signup" novalidate>
<div class="form-group" ng-class="{ 'has-error' : signup.firstname.$invalid && ...
0
votes
1answer
21 views
How to check if expression will have a value after evaluating
Let's say I have a following template:
"foo['x'] = '{{ myVar }}';"
Is there an angular way of checking if evaluating this against my current scope will give myVar some value ? I've got an array of ...
0
votes
2answers
31 views
ng-show and $scope.$apply issue
On the HTML I have an overlay div to show a loading progress which uses the directive ng-show="showLoading". On the template ng-click I call the controller searchRequest method. This method updates ...
1
vote
3answers
39 views
AngularJS directives data binding doesn't work
DEMO
Here is a simplified version of the two directives I have, my-input and another-directive:
HTML:
<body ng-controller="AppCtrl">
<another-directive>
<my-input ...
0
votes
1answer
17 views
angular directive scope: setting a default value
I'm creating a datepicker directive, part of its markup is:
<select class="form-control" ng-model="day" ng-options="day.nr for day in allDays">
I'm trying to define allDays in the scope ...
0
votes
3answers
45 views
modify $http code into promise
This is the code I working on.
appControllers.controller('MyaSellerOrderCtrl', ['$scope', '$rootScope', 'Order', '$http',
function($scope, $rootScope, Order, $http) {
...
0
votes
1answer
14 views
AngularJS: How to inherit the scope the directive locates in, and get attributes value same time
Could anybody help with this? Is there a way to access the scope the directive located in (e.g. a controller's scope) while I still can access the attributes' value.
here is my directive code
...
0
votes
2answers
21 views
Angularjs only triggering ng-change on input radio the first time its selected
I have made a simple example using angularjs. This example contains three radio inputs, each of which have to call a function on change (ng-change => console.log). Unfortunately, the function its only ...
0
votes
1answer
31 views
Load directives based on value
my issue is that I have a directive as follow:
app.directive('bottomNavBar', [function () {
return {
templateUrl: 'views/bottomNavBar.html',
restrict: 'A',
replace: true,
transclude: true
};
...
0
votes
1answer
24 views
Multiple directives need to share same private scope
I have two directives, one is restricted to the element and the other to an attribute
<bar-foo special></bar-foo>
Now the issue is that the special directive need to define something on ...
1
vote
1answer
21 views
Using value of complex ng-model in controller from template
I have input box inside a loop in HTML :
<div ng-repeat="line in list.performance_recommendations">
<label>{{line.template.message}}
<input class="k-textbox" ...
1
vote
1answer
35 views
How to get field that made form dirty in angular?
Is there any way to know what field made the form dirty in Angular? I have an "auto save" directive that checks if there was any change inside the form, and saves it accordingly (trough server ...
0
votes
0answers
26 views
Angular and MEAN.js $scope attributes are undefined
I am currently developing a little app with Angular and MEAN.js.
I would like to plot a D3 chart with some real data coming from the model.
To do so, I would have to read from the $scope.campaign ...
0
votes
1answer
26 views
Socket.io and $scope.$apply()
I'm trying to build a real-time voting app using angular-fullstack. I have everything working except for when I receive a vote, my percentages don't update. I've determined that I need to call ...
0
votes
0answers
13 views
Nested tree view menu with directives
I have to create a sidebar menu that has two or three levels and that the developer can enable or disable some features, such as icons, labels and animation. I have created four directives, one for ...
1
vote
2answers
33 views
AngularJS dynamic scope variables
I have a scope variable jsonData as below:
$scope.jsonData={id:'1234',abcd:{array:[{a:'data',b:'bdata',c:'cdata'},{a2:'a2data',b2:'b2data',c2:'c2data'}]},efg:{test:'testdata'}}
in my HTML I have a ...
0
votes
1answer
7 views
Append directive to body
I have a popup directive, and I would like to compile and append it to body. Is there a simpler way then recompiling and appending directive to body.
link: function (scope, element) {
...
0
votes
2answers
23 views
What sense does have a new child scope inaccessible from parent controller? (created by ng- directives)
In angular.js Some directives create child scopes. (ng-include, ng-if, etc)
I know there are ways to solve it, for example by declaring the variable in the scope of the controller. Just uncomment ...
0
votes
0answers
32 views
Using scope in Angular directive templates
I have a problem in that I need to toggle some classes based on a value that can only be determined once the template has been compiled.
That's probably not a very helpful description but I'm not ...
0
votes
1answer
11 views
Two way databinding in Angular when using method in template
Is there a way to tell angular that a particular function in $scope is dependant on some other fields in $scope? I would like to hide some functionality in data model, for example:
$scope.user = {
...
0
votes
1answer
35 views
AngularJS - ng-repeat horizontally x number of times, then new line
I am trying to perform a simple ng-repeat on an <li>. In the past, i have created vertical ng-repeat. I am now trying to create a horizontal one, however, one that displays 4 items, then starts ...
0
votes
1answer
25 views
angularjs directive's '$element' is a comment because of ng-if
I'm trying to build a popup (dialog) directive for my angularjs application. (still lots todo...)
However I made a template file which builds the popup element, with insertion of values from the ...
0
votes
0answers
31 views
AngularJS Directive scope inheritance
I am trying to create a angular tree directive, here is the codes :
//** Tree constructor
var Tree = function() {
return {
restrict: 'EA',
replace: true,
template: "<ul>" +
...
3
votes
2answers
34 views
Isolate scope - access scope attributes on element
When creating a directive with isolate scope, I can't access scope properties on the directive element (it's was not the case in angular 1.0.7, but in later versions (e.g. 1.2.17)).
...
0
votes
1answer
40 views
Why variable in $scope does not update?
Code in plunker.
I have two controllers. In first controller i have handler for button in my view
$scope.click = function () {
$location.url("/some");
console.log("clicked");
}
In handler i ...
1
vote
1answer
25 views
Is there a way to pass multiple functions to an AngularJS directive?
I am building a dropdown menu directive which allows you to optionally attach a function to each item in the list. I know how to pass one function per attribute into the directive, but I'm hoping that ...
0
votes
1answer
16 views
Using scope variables with non-form elements
If I have 2 divs (removed ng-click function for simplicity)
<div ng-class="{selected: header.type == 'percent'}" data-type="percent"></div>
<div ng-class="{selected: header.type == ...
2
votes
0answers
33 views
AngularJS: Directive Scope is not getting $destroy called
Been searching for awhile in the archives and on the 'net for an answer, but not really finding one, just bits and pieces. Seems there's a lot of suggested posts, but none of those have the answer.
I ...
0
votes
2answers
27 views
$scope array and $scope.$apply in angularjs
I'm learning AngularJs and I'm facing a problem.
I want to show an array of items in a view. First in the controller I define the array using $scope.arrName = [], then I receive data from a third ...
0
votes
0answers
18 views
Get the data on foundation reveal modal
i am trying to search the records with some parameters and get the search result on the reveal modal,i am happily doing with posting the search parameters and getting the data on scope,But not getting ...
0
votes
1answer
39 views
$scope variable has no content
I had controller and function getData as shown. The problem is that the $scope.results outside the for loop has no content. While inside the second http.get request, It has content.
...
1
vote
1answer
34 views
checking function when model changes in other instance of the directive?
In angularjs I have made this simple example with two inputs. I want to change the background color of a input to green if its value its equal to 'green'. This example works, (it changes the ...
1
vote
0answers
20 views
Angular: Order of custom event handlers & default handler
In my application, I am defining a custom event for which I wish to have default handler in place. If any controller/service wants to override default handling, they can do so by adding their own ...
0
votes
1answer
12 views
Pass Data Between Angular UI Modals
I am looking to pass data between modals using Angular UI. Here is the modalController that defines the controller and view partial for each modal.
app.controller("modalController", function($scope, ...
0
votes
1answer
42 views
$rootScope and factory methods
I am trying to extend the $log provided by AngularJS through .config() and $delegate, so that I can catch all the calls to $log and $broadcast them. This way, other controllers can catch the $log ...
1
vote
2answers
36 views
Angularjs databinding between factory and view
I'm having some trouble with databinding in AngularJS.
In short I'm trying to link a variable from my factory to my view (the $scope).
The factory (in my full implementation) listens to specific ...
0
votes
1answer
26 views
Angular dialog directive with compile function and ng-show does not work
Inspired from this article I created a dialog directive. But I want to be a bit more flexible (e.g. not creating new variables/functions in the controller by hand for each dialog. I also want to have ...
0
votes
1answer
52 views
Angular - Directive attributes vs scope variables
I have some difficulties understanding the directive attributes vs scope variables passed in a directive.
I am working on a directive that dynamically loads the correct template depending on the ...
0
votes
3answers
27 views
Angular module dependencies
I want to create seperate module for pagination, because I will need it to reuse in different modules, but I don't know how to call a function from module dependency (another module)
Here is my main ...
1
vote
2answers
35 views
In my service-factory I lookup up a large dataset - I want to persist it and check for its existence to avoid calling it again
My service (factory) makes an API call and assigns response data to a variable:
.factory('MedicationMatchingNamesFactory',
['$http', '$q', 'MedicationDisplayNamesFactory',
...
1
vote
1answer
20 views
Do I have to use $watch to dynamically pass isolate scope attributes to my custom controller?
I have a controller that stores super heroes. I would like to use a custom directive to display a certain super hero based on the value entered in an input field. I do not wish to achieve this with a ...
0
votes
2answers
28 views
Inject one service (factory) into another, both of which are async
I should do the following:
query an API for a large dataset of names, probably via a service/factory, using $q (async)
have another service (also async) which should only return elements of the ...
0
votes
0answers
15 views
JQuery file not loading on page with ng-repeat
I am building a real estate listings page for a client of mine with ng-repeat from a json data file that holds all his listings data. On each listing I created a 3 field form so I can tap into a ...
0
votes
1answer
17 views
Angular directive coming in JSON
I have a directive:
Here I am passing a data object:
<a-link options = "data"></a-link>
And here is my directive:
.directive('aLink', function() {
return {
restrict: 'AE',
...
0
votes
0answers
18 views
AngularJs directive - how to save '&' scope property in the link function
I'm trying to implement a simple button directive with this properties:
scope: {
text: '@',
enable: '@',
click: '&'
},
The click function will ...