Questions tagged [directive]

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".

1990 questions
48
votes
3 answers

How to use Angular structural directive with multiple inputs

I want to implement something similar with angular-permisssion. And with requirement to control the element's existance, I need to use angular structural directive. At the beginning, i think such syntax would work:

e-cloud
  • 3,891
  • 1
  • 19
  • 37

46
votes
4 answers

Angular JS resizable div directive

My site will have multiple sections, each of which I intend to be resizable. To accomplish this I've made a "resizable" directive, e.g.:
jayflo
  • 1,055
  • 1
  • 12
  • 21
45
votes
9 answers

Define AngularJS directive using TypeScript and $inject mechanism

Recently I started refactoring one of the Angular projects I am working on with TypeScript. Using TypeScript classes to define controllers is very convenient and works well with minified JavaScript files thanks to static $inject Array
Milko Lorinkov
  • 553
  • 1
  • 5
  • 7
41
votes
3 answers

AngularJS - Attribute directive input value change

I've got an AngularJS attribute directive, and I would like to take an action any time its parent input's value changes. Right now I'm doing it with jQuery: angular.module("myDirective", []) .directive("myDirective", function() { return { …
Mike Pateras
  • 14,127
  • 29
  • 93
  • 131
40
votes
13 answers

Check if variable exist in laravel's blade directive

I'm trying to create blade directive which echo variable (if variable defined) or echo "no data" if variable undefined. This is my code in AppServiceProvider.php:
pupadupa
  • 1,278
  • 2
  • 15
  • 29
40
votes
2 answers

How to check if a method argument of a directive is specified in AngularJS?

I've created a custom directive which contains a button. This button calls a method from parent scope specified by 'callback' attribute. Simple directive
Ferenc T
  • 461
  • 1
  • 4
  • 5
36
votes
1 answer

Angular 2 attribute directive input values are undefined and not set correctly

I have following directive (TextElementDirective), that has 4 input variables colorHex, fontFamily, fontWeight, fontStyle. I want to set an element's color and style using this directive. @Directive( { selector: "[text-element-map]", //…
D M
  • 387
  • 1
  • 3
  • 8
36
votes
3 answers

How to use the actual use of ng-Cloak directive in AngularJs?

What is the ng-cloak directive? Why do we use it?
Anil Singh
  • 3,818
  • 2
  • 35
  • 46
35
votes
2 answers

What are the benefits of a directive template function in Angularjs?

According to the documentation a template can be a function which takes two parameters, an element and attributes and returns a string value representing the template. It replaces the current element with the contents of the HTML. The replacement…
34
votes
4 answers

What are practical scenarios of *ngTemplateOutlet directive?

I was reading about *ngTemplateOutlet directive. The use of this directive is to instantiate a template dynamically by a template reference and context object as parameters. What I want to know is that we have so many things in Angular to achieve…
patrick.1729
  • 2,752
  • 2
  • 15
  • 23
33
votes
3 answers

what is the meaning of align an the start of a section?

What is the meaning of align an the start of a section? For example: align 4 a: dw 0 How does it save memory access?
user1462787
  • 539
  • 2
  • 9
  • 19
30
votes
6 answers

Understanding AngularJS ng-src

As explained here, the AngularJS directive ng-src is used to prevent the browser from loading the resource (e.g. image) before the handlebars get parsed. I'm currently using the following code:
Martijn
  • 5,021
  • 4
  • 27
  • 41
30
votes
6 answers

Angular Directive Different Template

I have a directive myDirective with variable type. If I run I want the directive to use templateUrl: x-template.html. If I do I want the directive to use templateUrl: y-template.html. This is my…
Massive Boisson
  • 1,587
  • 6
  • 21
  • 28
30
votes
7 answers

Alias 403 Forbidden with Apache

I'm trying to create a folder named week7 and an html page named hello.html in that folder outside the document root and have it viewed through an Alias directive. I created a folder named week7 out of the Document Root. I chose this location for…
Yousif
  • 335
  • 1
  • 3
  • 8
27
votes
3 answers

Angularjs: how to pass scope variables to a directive?

I am trying to use directive to create and append several tags to a
as shown below: module.directive('createControl', function(){ return function(scope, element, attrs){ console.log(attrs.createControl); // undefined } …
I159
  • 24,762
  • 27
  • 88
  • 124