Questions tagged [custom-directive]

64 questions
1
vote
1 answer

Vue JS: Open Menu Component with Button, Close with Click Outside of Menu

Vue JS 2.6.10 I have read a variety of SO posts about how to create a custom directive so that you can detect a click outside of a popup menu so you can close it. I can't quite get it to work because I have a button that opens the menu and clicking…
Clifton Labrum
  • 13,053
  • 9
  • 65
  • 128
1
vote
2 answers

Custom Diasble Directive not working angular

I'm trying to create a custom directive for disabling a form field but it's not working. import { Directive, Input, ElementRef, Renderer2 } from '@angular/core'; @Directive({ selector: '[appCustomDisable]', }) export class…
1
vote
1 answer

Custom directive dom not change when parent scope make changes using {{}} with @ attribute

I am creating a custom directive with isolate scope using interpolation ({{}}) from parent scope, should be when parent scope is change the attribute should be updated with the new data. i have only 1 data been changed, the other is not change. i…
1
vote
1 answer

custom directive not working

I'm trying to create a directive for redacted/private information. If certain information is not provided a black box should be shown (as if the content was there but made invisible with a black box) import { Directive, ElementRef, Renderer, OnInit…
1
vote
1 answer

Not able to fetch value of isolated scope

Not able to fetch value of isolated scope "check".For testing purpose I'm passing index value to "check". I have to add animation when ng-repeat finishes, But "scope.$last" is also giving undefined value. I'm not to find what is wrong in my code…
1
vote
0 answers

Vue2 Custom Directive modifying component call

I am attempting to write a Vue directive that updates the properties of a component before the component is evaluated. For example, consider the following. Hello b-modal is a Vue Component and it…
Chris K
  • 11,622
  • 1
  • 36
  • 49
1
vote
1 answer

I am not able to use 'ng-change' in one of my custom AngularJS directives

ParentPage.html {{item.name}} Directive controller directive = { restrict: 'E', controller: ABCD, scope: { …
1
vote
1 answer

AngularJS: Table with ng-repeat on table row / column

I need to create a table from an array of objects but I don't want to hardcode the table. I can't do this or this for example. I rather need nested ng-repeats like this. But my case is a little bit different because I have columns which contain two…
1
vote
2 answers

How to bind ng-click to a custom directive and call a parent function?

We are using Angular 1.4.2 and I am trying to take a count value from a directive using ng-click, pass it to a function, then pass it up to the parent controller. After some effort it is working in a plunker, but unfortunately when I tried to move…
James Drinkard
  • 15,342
  • 16
  • 114
  • 137
0
votes
1 answer

Adding an svg programmatically using an angular custom directive

I have an Angular 12 application, where I'd like to add a custom directive for Elements that adds an external link icon (svg). The icon should be added after the link, like this: The directive should be used like this:
gizmo
  • 81
  • 8
0
votes
0 answers

Alpha Numeric Directive is not working for Special Characters

I'm working on a Custom Directive in Angular 13 with Reactive Forms as well as Angular Material. I want the directive to allow only Alpha Numeric values in my Employee Number input field. What I ideally want is that the first two values should be…
0
votes
1 answer

Vuejs3 how to register a custom global directive in a separate folder?

I wanted to move my global custom directive into a separate folder and import it from a file, but I fail to do so in Vue3. I got a: Uncaught TypeError: Cannot read properties of undefined (reading 'directive') Here are my files: main.js import {…
0
votes
1 answer

How to use controller with custom directive in AngularJS?

Let's say I am using a custom directive named my-form-data: Inside directive definition, I want a different templateUrl based on the…
0
votes
1 answer

Angular: Does Angular support two custom directives on the same DOM element?

I was following the example on creating a custom directive from angular.io. The original code is hosted on stackblitz. However, when I modified the code to create a secondary directive and applied it to the same element, I do not see it getting…
user96551
  • 185
  • 11
0
votes
1 answer

angular custom directive for class binding

My directive import { Directive, HostBinding, Input } from '@angular/core'; @Directive({ selector: '[highlight]' }) export class HighlightDirective { @Input('highlight') isHighlighted = false; constructor() {} @HostBinding('class') get…
Saad Saif
  • 101
  • 1
  • 2
  • 8