Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/wcf/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angular 离子玻片_“活动幻灯片未定义”;调用slider.startAutoplay()后出错_Angular_Ionic Framework_Ionic2_Ionic3 - Fatal编程技术网

Angular 离子玻片_“活动幻灯片未定义”;调用slider.startAutoplay()后出错

Angular 离子玻片_“活动幻灯片未定义”;调用slider.startAutoplay()后出错,angular,ionic-framework,ionic2,ionic3,Angular,Ionic Framework,Ionic2,Ionic3,这个问题只有在我尝试使用自动播放功能时才出现 我已尝试在html中包含该选项: <ion-slides #homeSlides *ngIf="slides" autoplay="5000" autoplayDisableOnInteraction="false" initialSlide=0 pager="true" loop="true" effect="fade" autoHeight="true" > <ion-slide *ngFor="let slide o

这个问题只有在我尝试使用自动播放功能时才出现

我已尝试在html中包含该选项:

<ion-slides #homeSlides 
*ngIf="slides" 
autoplay="5000"
autoplayDisableOnInteraction="false"
initialSlide=0 
pager="true"
loop="true"
effect="fade"
autoHeight="true" >
  <ion-slide *ngFor="let slide of slides" >
    <ion-card (click) = "openPage(slide.component)">
      <img id= "slide-img" [src]= "slide.img">
      <div class="card-title" text-wrap> {{slide.title}} </div>
      <div class="card-subtitle" text-wrap> {{slide.subtitle}} </div>
    </ion-card>
  </ion-slide>
</ion-slides>
}

使用第二种方法,stacktrace是:

ERROR TypeError: s._activeIndex is undefined
Stack trace:
autoplay@http://localhost:8100/build/main.js:42425:26
startAutoplay@http://localhost:8100/build/main.js:42469:5
Slides.prototype.startAutoplay@http://localhost:8100/build/main.js:55099:9
HomePage.prototype.ionViewDidLoad@http://localhost:8100/build/main.js:45351:9
ViewController.prototype._lifecycle@http://localhost:8100/build/main.js:17317:13
ViewController.prototype._didLoad@http://localhost:8100/build/main.js:17190:9
NavControllerBase.prototype._didLoad@http://localhost:8100/build/main.js:44560:13
....
我已经浏览了上的幻灯片和Swiper实现,但我找不到_activeIndex(或activeIndex)从何处获取的值不是
null

我知道这发生在文件第204行的autoplay()函数上

希望消息来源能帮助别人发现我的错误

不确定这是否与此有关,但当我尝试使用[options]属性并从数组加载属性时,总是会出现错误:

Error: Uncaught (in promise): Error: Template parse errors:
Can't bind to 'options' since it isn't a known property of 'ion-slides'.

有人知道如何解决这个问题吗?谢谢

为什么要这样做。slider.update();等在ionViewDidLoad()中?我不知道是否有任何关系,但他们是不需要的。是的,你是对的。我添加了这个,因为我想知道这是否只是Slides对象的原始构造的问题,在这种情况下update()会刷新它。不工作不需要
initialSlide=0
。如果要添加,请定义ion幻灯片的索引
让i成为索引
的一部分,并删除
*ngIf=“slides
,这是不必要的。
Error: Uncaught (in promise): Error: Template parse errors:
Can't bind to 'options' since it isn't a known property of 'ion-slides'.