Tagged Questions
0
votes
1answer
10 views
Pass ng-repeat expression to ng-click function
The html template contains a list of items filtered
<ul class="gift_info">
<li ng-repeat="code in codes | filter:{id_id:detail.id}">{{code.discount}}</li>
...
0
votes
0answers
9 views
$rootScope.digest throwing 'no more request expected' in angular directive unit test
I've coded a directive that checks some permissions and delete an element from the DOM if permissions are KO.
I'd love to unit test it, but... hem, I'm banging my head agains walls to make this ...
0
votes
3answers
15 views
AngularJs behavior button
I have a button:
<button data-ng-click="toggleElement(asset)" class="btn"><span class="text-center">Add To Cart</span></button>
I would like to hide this button when ...
0
votes
4answers
21 views
Angularjs disable select option after button click
Is there a way to disable the select option after clicking on a button in Angularjs ?
i've found a way by using ng-disabled directive.
is there a way to use this directive on <select> tag and ...
0
votes
2answers
7 views
Angular Directives: Link to Controller without Services
I'm gradually getting the hang of Angular directives and so far, have resorted to creating a service as an intermediary between controllers.
I was just wondering, in the context of directives (and ...
1
vote
1answer
18 views
AngularJS Directive Passing String
This directive is trying to create an HTML element called progress bar that tracks progress as you move page to page. I'm trying to develop it to be used as :
<progress-bar progress='1' ...
1
vote
2answers
28 views
AngularJs How to pass the complex object in directives
iI have this directive :
amDirective.directive('directiveList', function() {
return {
restrict: 'A',
scope: {
'event': '&onEvent'
},
transclude: ...
0
votes
1answer
16 views
How to use require option in directives
In documentation I can read next for the require option:
When a directive uses this option, $compile will throw an error
unless the specified controller is found. The ^ prefix means that this
...
0
votes
1answer
17 views
Angular view gets out of sync with model when dragging items from one list to another
I have created a custom directive that allows me to connect multiple sortable lists via drag and drop using angular js and jquery ui. The way it should work is the following:
When drag starts, keep ...
0
votes
0answers
19 views
How to set parent scope for ngInclude
I have a directive that needs an isolated scope for its work
one of the parameters it receives is a templateUrl that it pass on to ng-include
Is there a way to tell ng-include to generate its scope ...
0
votes
1answer
21 views
AngularJs $compile finish / end event
Hi I would like to know,
if there is a way to get something like promise (i guess it will be postLink in this case) on $scope.
i an unanswered question here: AngularJS: how to know when the $compile ...
0
votes
0answers
26 views
How to implement url for dynamic tabs in Angularjs
I have displayed dynamic tab menu's using ng-repeat and i want to get individual url for each tab is it possible to get the url? if so how can i handle the route. i think its not possible to to set ...
1
vote
0answers
15 views
Animate element moving between lists
Using AngularJS, I would like to animate an element being added to one list from another, as in a clone of the element should appear to move in the page from the menu of items, and be added to the ...
0
votes
1answer
26 views
AngularJS: render partial with dynamic attributes
I'm a AngularJS newbie.
I am looking to pass data when loading partials.
I'd like to have a directive that would allow for dynamic attributes. For example, in a view where an object "company" is ...
1
vote
1answer
40 views
A simple, efficient Angular JS directive to replace HTML
I'm trying to create a very simple Angular JS directive which simply replaces an tag with an SVG icon which will differ depending on the name attribute. So this...
<icon name="plus" />
might ...
1
vote
1answer
28 views
does ng-src create a new binding?
In my angularjs project I need to go back and forth using both ng-src and src attributes in my tags.
Some images are static assets and will never change (they may be conditionally displayed) while ...
0
votes
2answers
21 views
Custom form validation directive to compare two fields
I'm an angular newbie, and I'm stumbling over something in how angular's form validation directives work.
I know that I can fairly easily add directives to individual fields, but I'm trying to add a ...
0
votes
0answers
37 views
Passing scope through an angularjs directive
I want to create a reusable directive that passes the parent scope through the directive to it's child scope.
For example, I want to dynamically set the height of a container so that it can be ...
0
votes
0answers
20 views
Testing a directive with controller function that calls $element.off()
My directive calls a function like so:
.directive('upload', ['$compile','$http','$templateCache', function($compile, $http, $templateCache) {
return {
restrict: "CA",
controller: ...
0
votes
1answer
13 views
Attempting to pass an expression as an argument to a directive. Being taken literally instead of value
I'm trying to pass the value from an that is displayed through an ng-repeat into a function in my controller. The value displays properly in the HTML but when I get over to the function it displays ...
-2
votes
0answers
32 views
Planning angular applications [on hold]
I'm new to angular and am making a sort of 'product card'. One side shows information and when you click a button, the current content fades and a form shows up on the card. How would you go about ...
0
votes
1answer
27 views
Unit testing AngularJS Directive with isolated scope - how to get bindings to output?
I'm really needing advice and guidance on testing AngularJS directives with Isolated Scope.
Say I have the following directive (which works):
angular.module('myApp')
.directive('pageNav', ...
0
votes
1answer
65 views
AngularJS: Custom 'select' directive - wrong ng-model value in angular 1.2.6/7
i'm trying to create simple directive, which could be used like this
<select custom-select="types.SOME_TYPE" ng-model="a.SELECT" />
my directive:
m.directive('customSelect', function () {
...
0
votes
1answer
16 views
Display autocomplete list into a angularjs modal directive, list is ok but display not
I expect to display jquery autocomplete list into a angularjs modal within a directive.
I handle to display the list but it is displayed behind the modal.
See demo
Thanks
0
votes
2answers
32 views
Angularjs isolate scope fails in undebuggable way
Ok, so im really struggling with trying to use isolate scopes with an angular directive.
Here's the html, assume i have a valid array in the objectivesJson property:
<div lesson-plan ...
0
votes
1answer
20 views
How to load a directive template before evaluating javascript
I'm using KineticJS in conjunction with AngularJS and I want to be able to stash the necessary javascript into a directive. All of the examples I've seen for KineticJS wrap the required logic in a ...
0
votes
1answer
27 views
How to remove deleted row in ng-table
I have a grid developed using ng-table and I need to remove selected item from grid table after removing from server-side. Already tried to call the grid loading ajax again, but it's not working.
My ...
0
votes
1answer
33 views
Equivalent of Knockout Applybindings In AngularJs
I am using knockout since 2 months and now I am reading and trying to learn angularJs. In knockout I was creating some data dynamically using jquery. Which depends on the data which I receive from the ...
0
votes
1answer
7 views
Overlapping Markers with AngularGM directive
I have two markers that are very close to each other. When the map is zoomed out they overlap.
Problem: There is a marker event that changes the icon of one of the markers but it won't show for the ...
0
votes
0answers
19 views
Directive isolated scope vs attrs.$observe
As a new Angular user, I've ran into a problem where I can't have multiple directives with isolated scopes on one single element.
I have since realised, I can use attrs.$observe on the directive's ...
0
votes
1answer
16 views
AngularJS Chart Directive - Data loaded in async service not updating chart
I am having one chart directive created, and I am bootstrpping the app after loading google api. In following code, a simple data table is working fine. But when I load data from server in async ...
0
votes
0answers
17 views
Testing a directive that doesn;t have template or template URL.Not able to access html element
I am trying to test my directive.It cannot access the html generated by the directive and prints an empty object. My code for testing the directive is as follows.
UPDATE: I noticed while debugging ...
0
votes
4answers
43 views
AngularJS directive to parse and replace custom element contents
I would like to create a simple markdown directive that accepts some content within the element, parses it and replaces it with html.
So this:
<markdown>#Heading</markdown>
or this ...
0
votes
1answer
25 views
Isolate scope variable is undefned
For some reason I am not able to access my isolate scope variable "index" in my link function. I have tried both @ and = to see if it made any difference and this had no effect, I also tried using a ...
0
votes
1answer
43 views
AngularJS: Call external functions from directive?
I'm trying to create a custom component that uses external functions defined in the controller, but I'm experiencing different problems.
Example:
I want to create a custom input with a external ...
0
votes
2answers
53 views
Transcluding ng-click in a directive
I am building an AngularJS directive. I want that directive to wrap other contents which have an ng-click inside of it. The resulting button does not do anything when clicked.
Here is a simplified ...
1
vote
0answers
32 views
Is it possible to upload and store an image to a directory using angular?
Can you store images to a local app directory img/airports/<image.jpg> using only angular, html, javascript/jQuery? if so, whats the best method to not only upload the image but also push the ...
0
votes
0answers
40 views
AngularJS: New scope for recursive directive template
Consider this AngularJS Directive.
Why do we need a new scope every time? Won't a single new scope be sufficient to compile against?
0
votes
0answers
33 views
Angular JS :Recursive directive pre-processing
I have a recursive directive the compiles an HTML element and appends to the DOM structure. The input data I get is the JSON tree. I want to augment the tree to do some pre-processing and set a watch ...
2
votes
1answer
88 views
initializing multiple directives
I am new to AngularJS.
to achieve a data-grid with a filter form I have created two directives in my main view.
myFilterForm - is a filter form for the data in the grid with the functions:
...
0
votes
2answers
36 views
Adding a JSON object using ng-submit + ng-model
How do I properly add(push) a object(nest) to a json using angular.
See live working demo on: JSbin Link
I have a factory of Airports with a particular structure:
angApp.factory("Airports", ...
1
vote
1answer
41 views
How to get the styling of a directive's element in AngularJS
I am trying to create a directive that uses the dimensions of its element. I've noticed that if the styling is done inline on the element then the related style attributes become available in the link ...
1
vote
0answers
34 views
angularjs directive with promise not changing html element
I'd like to translate text of tags using a directive getting the translation dynamically from my server as there is no reliable way to get the culture locale from the browser.
So I use a factory and ...
1
vote
2answers
46 views
How I can get compiled(?) string in angularjs directive
Here is code of my test directive:
mymodule.directive("test", function($compile) {
return {
restrict: 'E',
replace: true,
template:
'<div ...
1
vote
1answer
22 views
Why does this simple use of ng-init with delete give a syntax error?
This simple snippet (jsfiddle):
<div ng-app="App" ng-init="foo={a: 20}; delete foo['a']">
</div>
Creates this syntax error in both FF and Chrome. Why?
Syntax Error: Token 'foo' is ...
3
votes
1answer
121 views
+100
How to stop $observe in AngularJS
I had recently some issues with jQuery plugins in directives in Angular not being properly cleaned and hence, creating Memory Leaks.
So, today, while I was working on tests to ensure that won't ...
0
votes
1answer
27 views
Creating angularjs directive with id attribute for internal html but id still on outer html
So I have created this checkbox directive that is made up of a label and input element.
I want to set an id attribute on the directive and set this as the "id" of the input element and the label "for" ...
2
votes
3answers
42 views
Get AngularJS to compile directive and link function before executing the controller
Due to the nature of my program, I require functions to be placed on the scope and shared between the directive's link function and the controller, like so..
.controller("controller", ...
0
votes
1answer
71 views
ngModel data binding is not working properly
I am using ngSwitch directive to switch the view to Edit the div content. HTML is as follows -
<div ng-switch="isEditing" ng-controller="descController">
<div ...
1
vote
3answers
51 views
AngularJS: Binding boolean value to radio button such that it updates model to false on uncheck event
In my AngularJS application, I am displaying contacts data in a grid. My typical contacts JSON looks like as below ...
[
{ type: "IM", value: "mavaze123", default: true },
{ type: "IM", ...