At a high level, directives are markers on a DOM element (such as an attribute, element name, comment or CSS class) that tell AngularJS's HTML compiler ($compile) to attach a specified behavior to that DOM element or even transform the DOM element and its children.

learn more… | top users | synonyms

3
votes
0answers
65 views

Use custom Angular directive from within React

I am attempting to implement the "fast repeat" pattern of replacing Angular ng-repeat with a React rendering. I can render a basic table, but the table will need to support custom Angular directives. ...
3
votes
0answers
275 views

Angular ui-sortable + angular-gridster

I'm trying to combine the functionality of ui-sortable and angular-gridster so that I can pull an item from a list and drop it into a rearrangeable grid. ui-sortable and angular-gridster have the same ...
2
votes
0answers
20 views

Angular Directives VS Windows Phone Data Savings

I have a pretty curious problem with my (a little bit complex) Angular JS Application. In PC, Android, iOS, everything is fine, but, in Windows Phone, with Internet Explorer Data Sense Savings ...
2
votes
0answers
45 views

Placing HTML within directive tags

So far, I've been adding HTML to a directive via template/templateURL, but recently wanted to be able to vary the template of a directive based on what page its called on. I looked online and saw ...
2
votes
0answers
75 views

angularJS performance issue with timer fired

I am building a pretty huge angular app, My problem is the memory leaks resulting in page freeze. on clicking a button, my app opens up a popup,(with help of custom directive) the content of this ...
2
votes
0answers
168 views

Angular directive with $sce and $compile

I'm making a template builder that eventually saves the html of a certain div to the DB with a bunch of inline styles and ng-click links. I'm trying to render the saved html in the main container div ...
2
votes
0answers
67 views

How to create generic and specific directive in angular

I need to create generic "information boxes" that will be repeated over and over again in a web app. I need 3 different types of this boxes, let's say A, B and C. Their templates will be very similar, ...
1
vote
0answers
10 views

Splitting an Angular D3 Donut in to 2 sections

I am using Angular and D3 to display a donut graph, see plunker: http://plnkr.co/edit/Eoa2zAAEmTcnNfRNjgE4?p=preview From the above, you can see in the directive mark up i am passing a parameter for ...
1
vote
0answers
43 views

Scopes in Angularjs directives

Let's say I have this setup: Directive: angular.module('App.directives').directive( 'createCourseStep1' , function(){ return { restrict : 'E', replace: 'true', templateUrl : ...
1
vote
0answers
55 views

Creating PDF and HTML output using PhantomJS and evaluate Angular directives to be included both in HTMl and PDF output

I am trying to append a angular directive inside HTML so that PhantomJS creates the HTML and PDF output. The snippet is below: Code where I am trying to append Angular directive is below: function ...
1
vote
0answers
88 views

viewChangeListeners not working in angular directive

So basically, I want a directive that updates the class of an input whenever the viewValue isn't empty. Here is the code. angular.module('app').directive('input', function() { return { ...
1
vote
0answers
61 views

Bind a value to CSS via angular directive

I hope this is a simple enough problem: I have a directive which needs to add a left and right margin to the element its added to (a class directive) based on the value of a variable I pass in via ...
1
vote
0answers
46 views

How to delete a directive which has an isolated scope from the DOM properly

I have a directive with an isolated scope. How can I remove the directive from the DOM properly? I read that I have to remove the element from the DOM but before I also have to destroy the scope of ...
1
vote
0answers
105 views

use filter in angular directive to change collection in ng-options

I have the following directive to set the 10 most used languages in the beginning of a select and set a custom css class: app.directive('sortTopLocales', function ($timeout) { // copied from ...
1
vote
0answers
102 views

Angular Directive preventing updating ng-repeat collection

I am creating a mobile app using ionic framework. I am facing the following issue. I created an advance search option and added a popup option where user can select advance search criteria. But for ...
1
vote
0answers
163 views

Run directive after ng-options

I have a select input that loads the options from the model: <select data-custom-select ng-model="adAccount" ng-options="adAccount.name for adAccount in adAccounts" class="cs-select cs-skin-border ...
1
vote
0answers
103 views

AngularJS nested directive with ng-include

I have problem with nested directive in ng-include. Here's the situation: I have template in slim like this: ng-include src="includePath" quick-edit="" This includes file with template which has ...
1
vote
0answers
158 views

Convert date when fill datepicker manually in Angular

I'm using Persian DatePicker which is bulit from datePicker AngularUi to dispaly date in shamsi calendar. that's ok but when i to add date manually , datepicker can't convert it properly . I've ...
1
vote
0answers
419 views

ngTagsInput: disabling the input for tags upon a condition

I am using ngTagsInput to create some tags for my app. My problem is: tag input fields refuse to disable. Namely, I would like to disable the input field when the number of tags is equal to one. I ...
1
vote
0answers
81 views

How to pass directives to an element in the directives template in AngularJS?

I have a directive called step-field, in the template of the directive i have input or select elements that should sometimes have max-length or ng-required or some custom directive like ...
1
vote
0answers
301 views

angular - directive scopes not destroyed

I have a very strange problem with AngularJS & Compile functionality: http://plnkr.co/edit/7W9AbpaLqsYCecOWdIlz?p=preview I wrote a simple $compile structure, so I can insert dynamically ...
0
votes
0answers
30 views

Passing a method from directive to factory

I'm trying to pass a method that is defined in the controller, via a directive to a factory. I seem not to be able to fully understand scoping or the best way to do this. HTML: <div ...
0
votes
0answers
20 views

AngularJS: Directive template not getting rendered completely before calling link function

I am creating a directive that will basically tabulate passed in data. Here is the directive template- <div class="i_b" id="colorful-table"> <table class="table table-bordered"> ...
0
votes
0answers
27 views

multiple custom directive in single page angular.js

i am new in angular.js custom directive applabel.js app.directive('applabel', function(service, languageData) { return { templateurl: 'label.html', restrict: 'E', replace: true, ...
0
votes
0answers
23 views

Angular Directive addEventListener with ng-repeat

I currently have a directive that adds a few event listeners to an element in the link function. e.g.: ... link: function(scope, element) { // this gives us the native JS object var el = ...
0
votes
0answers
16 views

How to run child directive's ajax call only after parent's ajax call

I have been searching a lot for answers for this but I haven't found any. Let's say I have two different directives which gathers different kind data for two different variables. In other words. ...
0
votes
0answers
25 views

How to send ui-router resolve values into directives?

I am trying to resolve the templateUrl in the ui-router resolve and pass it to the directive. .state('app.student', { url : '/dashboard/:studentId', abstract : true, ...
0
votes
0answers
20 views

AngularJS, Loading spinner directive with transclude?

I want to make a directive with shows a spinner when $http request is executing. I thought this would be working (e.g. load users): Main Controller app.controller('UserListController', ...
0
votes
0answers
14 views

Kendo ui in angular js directive transclusion

Currently I'm testing kendo ui controls with angular js. I',m trying to create my own directive which is using kendo auto complete control. It looks like this: app.directive('testCompile', [ ...
0
votes
0answers
32 views

Firebase and Angular: How to convert string to date type in view?

Because Firebase doesn't support JavaScript Date objects, I converted the value of one of my object's keys with toString() (I will probably switch to using getTime(), but that's another topic.) ...
0
votes
0answers
8 views

multiple Image upload directive on a page - angularjs

I am very new to directives. I have written a directive by studying examples like below .directive('myImageUpload', function () { return { restrict: 'EA', //E = element, A = attribute, C ...
0
votes
0answers
37 views

Angular - Cannot get custom directive to cooperate with ng-change

I have a very simple directive (named cooperate-with-ng-change) which requires ng-model and I'd like it to cooperate with ng-change. Restated, I'd like to be able to do <cooperate-with-ng-change ...
0
votes
0answers
42 views

If I put my custom directive inside ng-if, its link function is never called

Even though the element is shown eventually. If I put it inside ng-show instead of ng-if, it works, but it needs to work inside ng-if as well. Both ng-if and ng-show are accompanied by ng-cloak. ...
0
votes
0answers
59 views

How to write controllers for custom directive in AngularJS and ionic?

I have a ionic directive ion-md-input. I want to create a custom directive out of it. The task at hand are validating that input field is of 6 characters and passing it to a $http.post. Sounds Simple. ...
0
votes
0answers
30 views

Angular pagination directive

I am using this paginatition but I think there is bug: https://github.com/michaelbromley/angularUtils/blob/master/src/directives/pagination/dirPagination.js Problem is with this: ...
0
votes
0answers
12 views

how to using ui-chart in our own directive?

I'm using ui-charts inside my own directives, by the chart is not getting drawn in the page. I have tried copying the same code and the chart options to the main page, and the chart appeared without ...
0
votes
0answers
37 views

Kendo-UI Numerictextbox angular directive k-rebind throws error

I have an angular directive using Kendo controls as following public constructor() { return <ng.IDirective>{ restrict: "A", template: "<div><input ...
0
votes
0answers
14 views

Dynamic change of height using ng-directive (cordova)

I have a directive: app.directive('heightaspercent', function() { return function (scope, element, attrs) { var windowHeight = $(window).height(); var changeHeight = function(){ ...
0
votes
0answers
27 views

Unable to use ng-minlength for input with custom directive in Angular

I've based a phone number formatting directive on this gist. Everything generally works great. But if I add a ng-minlength or ng-maxlength validation requirement, the input won't accept any input at ...
0
votes
0answers
21 views

Angular slide toggle not workign for tables

I have an Angular slide toggle directive which works fine for 's and <span>'s. However, when i try to use is on a , i get the following error in the console: TypeError: content is null var y = ...
0
votes
0answers
27 views

I want to call custom directive on button click and passing attributes as a parameters

This is html code <button type="submit" ng-click="get(selected_items)">Genrate</button> <pre>selected roles = {{selected_items}}</pre> <grid table-data="data" ...
0
votes
0answers
46 views

Why I not use $rootScope variable in $mdDialog Template?

I working with a Project and now I use $mdDialog directive. I declare a base url in $rootScope variable & it's work perfect with template but not with $mdDialog template. Why get this problem... ...
0
votes
0answers
20 views

How to use ng-model inside a directive function?

I have a codepen and I am trying to make a simple todo list. How can I use ng-model to get the value from the input text, and print it inside an appending div I have in a directive on click. Here is ...
0
votes
0answers
85 views

Angular directive - limit line count and length in textarea

Building up on this question, I am trying to expand the solution to handle wrapping lines and pastes. My idea is to limit the number of characters per line and any characters over the limit will be ...
0
votes
0answers
17 views

Angular Directive not updating binding on leaf element with no siblings

Hi im having some trouble with angular not updating bindings on leaf child with no siblings... i am using a directive "card" with transclude, and using a multi transclude function... as you can see in ...
0
votes
0answers
34 views

How to configure global hammer options in angular.hammer?

I want to set global options e.g. { "preventDefault": true } in angular .hammer touch events.
0
votes
0answers
31 views

How to load appropriate `template` on click of header link through a modal service

I am looking for the correct and best practice to handle this scenario. i have header element, it has a directive for navi links. when user click on navi-link i need to call the pop-up serivice ...
0
votes
0answers
32 views

AngularJS : directive compiling to another parent

Im trying to render directive's template into some other parent element. The case is i have directive width config: .directive('someDirective', function() { return { restrict: ...
0
votes
0answers
69 views

Directive with ng-repeat and ngmodel

I created a directive to mount forms the app, do ngrepeat to get the information from the fields and set the template. The problem is when I try to record the ngmodel the resource, I do not know how ...
0
votes
0answers
38 views

AngularJS : Load additional template in custom directive

I have an Angular custom directive which uses a very simple carousel template which only has 2 slides loaded and bound because I expect to repeat lots of them on a page. When the user interacts with ...