A concept of 'command' used by many programming languages and frameworks. Use this tag with a language and/or framework to indicate context. The C/C++ pre-processor is one language that relies heavily on directives. They call it "pragmas".
Questions tagged [directive]
2065 questions
0
votes
1 answer
Javascript variables not updated after Angularjs ng-repeat changes made to DOM
I have an angular app which extracts data from a JSON file which populates the webpage via directive template for the user using ng-repeat.
When the page is initially loaded, the ID(from the json file) in (p) element is 1.

Rehan Sarfraz
- 3
- 2
0
votes
1 answer
Angular typescript directive, find div inside element link
I'm using typescirpt in Angular.
I've created a directive that is just a div containing text and a close button with a class name 'block-close'
I need to add an click function to the close button.
How do I add a click event to button that is inside…

ttmt
- 5,822
- 27
- 106
- 158
0
votes
1 answer
Can't set variable in directive controller
I have created a directive as:
.directive('treeView', ['treeViewService', 'passClickService', '$compile', function (treeViewService, passClickService,…

DrewB
- 1,503
- 1
- 14
- 28
0
votes
0 answers
Angular typescript directive, jqueryLite addClass to body element
I'm creating a angular directive using typescript
The directive is a simple div containing information.
When the divs is clicked it opens a modal.
I wanted to add a class to the body tag when the div is clicked.
I thought I might be able to do it…

ttmt
- 5,822
- 27
- 106
- 158
0
votes
0 answers
Modify Directive-Parameters via Compile-Function
Question:
I would like to modify the parameter for ng-disabled via a directive on the same element so that
generates the same effect as…

H W
- 2,556
- 3
- 21
- 45
0
votes
0 answers
Reuse directive multiplie times with dynamic attributes in another directive's template
What i want to do is to be able to use a directive with different attributes in the same ng-app. The main goal is to run different code when the directive's input (ng-model) changes.
This is what i have now:
app.directive('customInput',
function…

Péter Kovács
- 1
- 1
0
votes
0 answers
Angular Custom Directive Not Being Intiatied
Sortable not being called and console log is not displaying. There are no errors in the console.
Here is the code I have.
jga-directive.js
(function() {
angular
.module('jgaDirectives', [])
.directive('jgaSortable', jgaSortable);
function…

mloomis
- 199
- 1
- 2
- 11
0
votes
1 answer
Dynamically changing content with AngularJS directive, factory, and ng-repeat
I am working on a widget that will dynamically change its content whenever I click a corresponding button. I have been spending a ton of hours to figure this out but I couldn't.
I have stored all the data that is provided with angular factory. What…

supergentle
- 1,001
- 1
- 14
- 33
0
votes
2 answers
Angular replacewith in directive and mouseenter/mouseleave
My target is pretty simple. There will be an show-overlay directive on images. If you enter mouse, it will wrap with a parent span and append overlay. On mouseleave it will remove the parent span and overlay div.
But for some reason if I use…

masum7
- 822
- 6
- 17
0
votes
1 answer
MVC Spring AngularJS Directive and Controller
I am trying to get a MVC with Spring and Angular JS and it is currently working [well actually it just calls the index.html so yeah].
The thing is, when I am in my index.html, I simply put a ng-include to another html file like this :

NPanda
- 41
- 9
0
votes
1 answer
During page load a whitespace is inserted into input element value every 67 characters
I have an Angularjs directive that will access the input element value during document ready event. The value is the base64 of the saved image.
app.directive('loadPhoto', function () {
return function (scope, element, attrs) {
//This…

tarekahf
- 738
- 1
- 16
- 42
0
votes
1 answer
pass value from angularjs directive link function to templateurl
I am trying to build a angular directive as shown below
Angular Json From
Angular Json From

dhana lakshmi
- 847
- 1
- 12
- 29
0
votes
1 answer
Adding toggleable buttons to DOM using Angular directive
See the following Plunker:
https://plnkr.co/edit/gLFw26zoJeaM5qtPjCFg?p=preview
I have an element that hooks into the scChart directive to add a chart to the page (I've omitted that part of the code since…

Paul Erdos
- 1,355
- 2
- 23
- 47
0
votes
1 answer
Transform Angular Directive in Vanila JavaScript function
My problem is how to transfer my Angular Directive to an JavaScript function. Ben searching for a weak now with out any success.
Since I have confidentiality agreement with my employer I can't share any of my code, but I think that question is…

Bojan Tomić
- 1,007
- 12
- 19
0
votes
1 answer
How to dynamically load temple in angularjs diretive without ng-include?
I want to dynamically load templateUrl in angularjs directive without ng-include.

Muzaffar Mahmood
- 1,688
- 2
- 17
- 20