Custom Attribute Directive | Directives | Angular 12+

preview_player
Показать описание
In this lecture, you will learn how to create a Custom attribute directive in Angular. The Angular directives help us to extend or manipulate the DOM. We can change the appearance, behavior, or layout of a DOM element using the directives.

We already learned about Angular's built-in directives like ngIf, ngFor, ngStyle and ngClass in previous lectures of this course. In this lecture, we will create an attribute directive like ngStyle and ngClass.

Let's learn how to create an attribute directive with an example.
Рекомендации по теме
Комментарии
Автор

Start to end, it's awesome & very informatic about private variable name & selectors...👏

mohammedabdulaziz
Автор

Shouldnt it be used with ngAfterViewInit instead of ngOnInit?

wiktorwachowski
Автор

After getting 1k subs, you will get 10k within short time, all the best.

leninnani
Автор

this.element = element is also not required in the constructor?

narenderkonka
Автор

This is helpful. Are you planning a series on Reactive forms? Just asking as I would like to see how you approach custom validation using custom attribute so that we do not have to add error templates in every single control. Can't get my head around it. I have seen it done but hard to understand. Thanks.

dshakya
Автор

I have a question. Why i have to create Directives, is it more simple if i use *ngClass and take some class form my css ot scss file .In which case more like i have to use this private Directives?

TheKidrock
Автор

hey sir, first of all great video secondly I have a question
Can I make that same attribute directive take the color as a value?? if so then how??

eyassh
Автор

I have a small doubt on this. When we use this custom directive in concern html file angular automatically detects the element and it is being captured in the constructor internally right!! Or am I thinking in that way

srikanthm