Incorporating a special Directive
onto elements to monitor their current scroll position seems like a handy feature.
Here's an example:
@Directive({
selector: '[my-scroll-animation]'
})
My goal is to make the element appear on screen with an animation once it reaches a specific position. In a Component
, I could easily achieve this by using an animations
property in the host
settings to trigger the animation.
Here's an idea of what I have in mind:
import { myScrollAnimation } from './animations';
@Directive({
selector: '[my-scroll-animation]'
animations: [myScrollAnimation] // <- is this feasible?
})
Any suggestions on implementing this animation functionality within a Directive?
Framework in Use: Angular 4.0.0-rc.4