I'm facing an issue that needs solving. I have a component containing a template.
ul(slider)
li(*ngFor="let car of getRecentCars()")
car-poster(bcg="{{car.recentBackgroundUrl}}", image="{{car.indexImage}}")
Additionally, there is a slider directive present.
@Directive({
selector: '[slider]'
})
export class sliderDirective{
private el: HTMLElement;
constructor(@Inject(ElementRef) elementRef: ElementRef) {
this.el = elementRef.nativeElement;
let _this = this;
setTimeout(function(){
$(_this.el).slick({
infinite: false,
slidesToShow: 1,
slidesToScroll: 1
});
}, 0);
}
}
The problem arises when the directive triggers before the component's data is available. Is there a way to delay the execution of the directive until the component finishes rendering?