【发布时间】:2016-11-23 15:44:41
【问题描述】:
我有问题,帮忙解决 我有一个带有模板的组件
ul(slider)
li(*ngFor="let car of getRecentCars()")
car-poster(bcg="{{car.recentBackgroundUrl}}", image="{{car.indexImage}}")
还有指令滑块
@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);
}
}
但是该指令是在组件中的数据之前触发的 怎么做才能推迟启动指令渲染组件
【问题讨论】:
标签: typescript angular angular2-directives angular2-components