https://codecraft.tv/courses/angular/custom-directives/creating-a-custom-directive/
https://www.youtube.com/watch?v=YAlxSudXg_g&list=PL-TLnxxt_AVGz9wRWkCajUkcH5zfa9JKP&index=34&t=9s
https://youtu.be/YAlxSudXg_g [Make a Custom Angular Directive]
<div class="card card-block" ccCardHover>...</div>
import { Renderer, Directive, ElementRef } from '@angular/core'; import { } from '@angular/core'; @Directive({ selector:"[ccCardHover]" }) class CardHoverDirective { constructor(private el: ElementRef, private renderer: Renderer) { //renderer.setElementStyle(el.nativeElement, 'backgroundColor', 'gray'); el.nativeElement.style.backgroundColor = 'gray'; } }
No comments:
Post a Comment