Angular 2 hover class directive
✓ Published0🌍 Public
Aackuser
Last edited Feb 23, 2017
Created on Apr 23, 2018
This Angular 2 directive adds a hover class to an element when the mouse enters it and removes it on exit. It uses the `@HostListener` decorator to listen for `mouseover` and `mouseout` events, and the `Renderer.setElementClass` method to toggle the class on the host element. The directive takes a `hoverClass` input from the template to specify the class name. It relies on Angular’s `ElementRef` to access the native DOM element.
AI-generated description