使用Ngu Carousel和Angular 4时出错

时间:2018-02-07 23:32:28

标签: javascript angular

我正在尝试将此轮播(https://github.com/sheikalthaf/ngu-carousel)与Angular 4一起使用,但我一直收到此错误。

enter image description here

在App模块和组件中进行了所有导入之后,我已将模板中的代码简化为此,但仍然不会消失错误。有什么想法吗?

LINE=$($SHUF <"$fileName" | tr  ' \011' '\012' |  head -n "$len" | tr '\n' '   ')
echo "$LINE"

以下是组件中的代码:

getting and picking the
and picking the daisies
picking the daisies when
the daisies when suddenly
daisies when suddenly a

1 个答案:

答案 0 :(得分:0)

尝试添加这两个按钮,

<button NguCarouselPrev class='leftRs'>&lt;</button>
<button NguCarouselNext class='rightRs'>&gt;</button>

查看ngu-carousel.component.ts的源代码,在ngOnInit()中有几个对nativeElement的引用。我会说以下很可能是导致问题的原因

  • this.rightBtn = this.next.nativeElement;
  • this.leftBtn = this.prev.nativeElement;

其中this.nextthis.prev

设置
@ContentChild(NguCarouselNextDirective, { read: ElementRef })
private next: ElementRef;
@ContentChild(NguCarouselPrevDirective, { read: ElementRef })
private prev: ElementRef;