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

2065 questions
0
votes
2 answers

Jasmine not working for link directive on document click

My Directive Link function is given below - link:function(scope,elem,attr){ $(document).on("click",function(event){ var target = $(event.target); if(target.is('.detailBox') ||…
anand patil
  • 507
  • 1
  • 9
  • 26
0
votes
0 answers

One time binding inside a directive

i'm trying to implement the 'one time binding' inside a directive and unfortunately it doesn't work. I looked for similar questions but the solutions don't seem to feet. First I tried the one time binding with a property which I've change it's value…
Tom Baum
  • 23
  • 5
0
votes
1 answer

After element.replaceWith(contents) how can go back to the original code

i have a problem that when i replace an element html i don't know how to go back to the original code before replacement. Here is my code. http://jsfiddle.net/Mahmoudbay/o166xg0s/94/ here is the controller. angular.module('App', []) …
Mahmoud
  • 23
  • 1
  • 6
0
votes
0 answers

AngularJS directive data binding inside a popover

Hi I'm creating an Angular bootstrap popover, and the popover contains a directive. The user story is that when the user clicks on a row inside an ui-grid table, the popover will show. But it seems that in HTML code the data is not actually passed…
richards
  • 517
  • 9
  • 27
0
votes
1 answer

Angular directive optional templateUrl

So I have a directive that can either be an attribute, or an element. When it's an attribute, I don't want to load any template inside the existing element it's been declared on. When it's an element, I want to load a given template and populate the…
gkpo
  • 2,623
  • 2
  • 28
  • 47
0
votes
1 answer

Is there a possibility of #define preprocessor macro definitions in VB.NET?

I am trying to write a VB.NET program which deals with a lot of small bit manipulations for which I am really missing the #define macro's which can be used in C/C++. Is there a possibility to define preprocessor macros. For example, #define…
Ali Habiby
  • 69
  • 1
  • 7
0
votes
3 answers

how to inject validation attributes dynamically inside angular directive

I am using the Angular 1.5.2, building the validations on the top of the ng-messages. Basically, that is supposed to be like this, and certainly that works.

{{myform.name.$error}}!

khoailang
  • 725
  • 1
  • 15
  • 32
0
votes
0 answers

How can i write dynamic angularjs directive for validate?

I am newbie in angularjs, and I have a question. I want to write only a directive for validate all types data (string, number,etc). I wrote in JSFIDDLE,you can visit here: http://jsfiddle.net/wk8rbot5/5/, it worked. But I dont want to use if-else…
Ca Pham Van
  • 316
  • 1
  • 3
  • 12
0
votes
0 answers

Angular dropdown not passing correct value

I have written a directive that as part of the functionality, reads a dropdown menu and passes the value back to an API. After investigating the network information, I've determined it's not detecting the change in values, and is always just passing…
M. Lynch
  • 1
  • 1
0
votes
1 answer

Scroll to top an image in sidebar angularjs directive

I need to scroll the active image to top using angularjs directive. When i tried to process with element[0].offset() its throwing error. Explanation : Here i am hardcoding the active element to 5 in the line. No need to code for that as i could set…
Alaksandar Jesus Gene
  • 6,523
  • 12
  • 52
  • 83
0
votes
2 answers

C++- Macro definition throwing error

I am new to c++ programming. I am trying few things I tried using directive in following way as shown in below program just for trail it is throwing error IDE used:VS 2015 language :VC++ Project type: library Error occured is Error: Expected an…
0
votes
1 answer

Use vue.js methods with select2 directive

I've create a new directive to use the jQuery Plug-In Select2 with vue.js as written down on the vue.js example page. But I don't want to just output the value of the selected option. To store the selections I try to bind my custom method create to…
kindisch
  • 766
  • 1
  • 7
  • 23
0
votes
2 answers

angular add function to $element in directive

I have a page with two directives. I need to invoke a function in one directive from the other. I have added the function to the $element object of the first directive and used jQuery to invoke it from the other. Is this the right approach or…
OLahav
  • 1
  • 2
0
votes
1 answer

Best way to bind directive form fields to root scope variables

I created a directive to handle form input groups. Each input needs to be bound to a root scope variable. I set up a factory to store the variables so that I can use them in the main controller and directive. So far, I've gotten as far as to have…
Wayne F. Kaskie
  • 3,257
  • 5
  • 33
  • 43
0
votes
0 answers

understanding directive angular

everyone. I am not experienced with angular, so help needed. i have a directive : app.directive('ngDirective', [ '$timeout', function ($timeout) { return { templateUrl: '../tpl/tpl.html', restrict: 'E', scope:{ item:'=', …