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
30
votes
7 answers
angular 2 typescript An implementation cannot be declared in ambient contexts
I am new to typescript and I am trying to create a function for an angular 2 directive.
Can anyone explain, in language for n00bs, what the error is trying to tell me when I am compiling with Gulp?
An implementation cannot be declared in ambient…

poashoas
- 1,790
- 2
- 21
- 44
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,617
- 7
- 22
- 28
27
votes
3 answers
Vue - How to render HTML in vue components
This is what I'm trying to accomplish:
{{ span('Hello') }}
And what desired output should be is:
Hello
Is this possible?
Thanks

Kevin Gorjan
- 1,272
- 1
- 17
- 34
27
votes
4 answers
Attribute directive with ngModel to change field value
I want to change (force) input field values while typing using a attribute Directive. With it I would like to create directives like uppercase, lowercase, maxlength, filterchar, etc. to be used on input fields on forms. I found this example: Angular…

majodi
- 536
- 1
- 7
- 17
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
- 29,741
- 31
- 97
- 132
26
votes
4 answers
AngularJS + Karma + Ng-html2js => Failed to instantiate module ...html
I can't make Karma working for directives that have external templates.
Here is my karma configuration file :
preprocessors: {
'directives/loading/templates/loading.html': 'ng-html2js'
},
files: [
...
…

Vincent
- 384
- 1
- 3
- 11
22
votes
1 answer
Append html to an element in directive and make a local function to interact with it
In my AngularJS application, I have different complex inputs everywhere. For example, some inputs have a directive to use autocompletion with Google Places or with autocompletion from Twitter Bootstrap.
I'm searching for a way to make a directive…

harkor
- 483
- 1
- 5
- 14
22
votes
4 answers
AngularJS element directives not displaying when using self-closing tags
I have in my html file directives
and the directives are on the form
.directive('add', ['$window', ...
and
.directive('back', ['$window',
This works fine.
If i change the directives to camel case:
.directive('addPlayer',…

Hawk
- 1,513
- 1
- 14
- 17
21
votes
3 answers
define mark up for generic sphinx admonitions with a specific title
I am using Sphinx to generate HTML documentation for a Python program.
I would like to use the generic admonition directive with a specific title and have it marked up in a way I can define, for example like content generated with the note…

equaeghe
- 1,644
- 18
- 37
21
votes
1 answer
AngularJS - load google map script async in directive for multiple maps
I am currently trying to load multiple google maps on a single page.
I don't want to include google map API script into the HTML code as I don't want the script to be loaded unless the maps are in the current page.
I want my maps to be called inside…

Niflhel
- 663
- 1
- 5
- 19
19
votes
6 answers
Detect Ctrl + C and Ctrl + V in an input from browsers
I am using the direct following and I do not detect the copy and paste with the keys inside the input, would someone know how? Thank you!
export class OnlyNumberDirective {
// Allow decimal numbers. The \, is only allowed once to occur
…

Mario Ramos García
- 755
- 3
- 8
- 20
18
votes
4 answers
Can specific Delphi hints be disabled?
In Delphi, you can use compiler directives to disable specific warnings, such as
{$WARN USE_BEFORE_DEF OFF}
But when I tried to do that with a specific hint, whose underscore_style_name I got out of the helpfile, the compiler said it doesn't know…

Mason Wheeler
- 82,511
- 50
- 270
- 477
18
votes
1 answer
Unit testing a directive that defines a controller in AngularJS
I'm trying to test a directive using Karma and Jasmine that does a couple of things. First being that it uses a templateUrl and second that it defines a controller. This may not be the correct terminology, but it creates a controller in its…

The Zuidz
- 678
- 3
- 8
- 18
16
votes
3 answers
How do you define a multiline macro in C?
How do you define a multiline macro in C?

Luis B
- 1,684
- 3
- 15
- 25
16
votes
3 answers
angular2 access ngModel variable from a directive
I am trying to build a datetime picker directive like the following.
and date1 is assigned as a Date, e.g., new Date()
When I display this in html, text in input element looks like the…

allenhwkim
- 27,270
- 18
- 89
- 122