Skip to main content
0 votes
0 answers
63 views

Dynamic Directive not applying, in reusable controller

I'm trying to create a reusable controller for textbox, textarea, dropdown. etc, there are plenty of directives in my project. so I tried to render it dynamically validation-mask.directive.ts: @...
Kathiravan S's user avatar
2 votes
1 answer
99 views

How does the order of the imports in angular works ? Why is not working with one order and working with the other?

I created a directive that allow me to change the routerLink of my links. I encountered an error where the routerLink was not updated in one component, but was correctly updated in an other. I found ...
Gregory Boutte's user avatar
4 votes
1 answer
70 views

Should we use NgZone.runOutsideAngular() when handling fromEvent with filters in Angular

I came across this implementation of the outsideCLick directive ngOnInit() { this._ngZone.runOutsideAngular(() => { fromEvent<MouseEvent>(document, DomEventsEnum.MOUSEDOWN, { ...
Dima Savenkov's user avatar
2 votes
1 answer
141 views

Project structural directive using ng-content in Angular

I am working on an Angular project and I've made my own table <app-table> component by wrapping an existing table component from the team, let's say <inner-table>, inside it. Please keep ...
Nautilus's user avatar
1 vote
1 answer
80 views

Can't access inputs from host directive to HTML template

In the docs for Angular host directive, it's stated that I can use my inputs/outputs in the template like this. @Component({ ... template: "ID {{someId}}", hostDirectives: [ { directive: ...
Konrad Viltersten's user avatar
-1 votes
1 answer
79 views

Test IntersectionObserver's callback's actual code in an Angular directive

I am facing difficulties reaching the callback of the following IntersectionObserver's callback (which is inside a directive) in angular test code and thus are not being able to fulfill the test ...
Rawnak Yazdani's user avatar
2 votes
1 answer
86 views

Getting class attribute from ng-template

@Directive({ selector: "ng-template[model]", standalone: false, }) export class ViewSelector { @Input() get model() { return this._model; } set model(value: Object) { ...
Mud's user avatar
  • 29.2k
4 votes
1 answer
53 views

Double <ng-template> nesting with directive and contentChild = can't get second-level directive

Today I tried to make a custom table component. It must take column keys, default column template and column templates for some special columns to override their view. I use angular v19.2. I have this ...
Alex Smykov's user avatar
0 votes
3 answers
78 views

New @for Directive in Angular – Dynamic Array Issue

I'm creating a dynamic FormArray within a FormGroup. The only change I've made is switching from *ngFor to the new @for. The issue occurs when I try to remove an element from the FormArray. Previously,...
user30188574's user avatar
1 vote
1 answer
212 views

Angular Directive Composition: How to Pass a Computed Input?

I have a custom directive (myDirective) that composes a third-party directive (ThirdPartyDirective) via the hostDirectives property in Angular. I’m passing several inputs directly, but one of them ...
Matan Shushan's user avatar
1 vote
1 answer
104 views

How to get the old state in a input by doing Undo (Ctrl + Z) when the value is formatted using a directive?

I'm creating a thousand separator directive where 1234 will be shown as 1,234 visually but behind the scene it will be 1234 only. So after everything is working expected. Problem is happening when I'm ...
avishekdr's user avatar
  • 1,128
1 vote
0 answers
112 views

How to make angular standalone directive globally available?

I have a few simple helper directives which I want to use throughout the entire app. With modules this was easy to do, but with standalone I don't know how we can do it. One example of such a simple ...
Nibo's user avatar
  • 138
0 votes
0 answers
107 views

Using @HostListener in Angular, on doing ctrl+v, Paste event not triggered when keydown event is also there AND on keydown event, ctrl+v not detected

On input type="text", I am using two directives - keydown and paste. My requirement is: I need to validate user input string character by character which will be done in keydown event, I ...
Agustus Codes's user avatar
1 vote
1 answer
69 views

How to provide different test cases by use of one test component for a directive which changes the element stlye in ngOnInit() in Angular 19?

I have a directive which looks like the following: import { Directive, ElementRef, Input, Renderer2, OnInit } from '@angular/core'; @Directive({ selector: '[appChangeStyle]' }) export class ...
Sonic's user avatar
  • 55
1 vote
1 answer
35 views

Directive cant bind to MatSelect with ContentChild

I'm having trouble with a directive that worked in Angular 8 but isn't binding to MatSelect in Angular 16. The directive is created, but @ContentChild never succeeds in binding to MatSelect. Directive ...
marc's user avatar
  • 126

15 30 50 per page
1
2 3 4 5
160