vitalii-andriiovskyi / ngx-owl-carousel-o

owl-carousel for Angular >=6
MIT License
177 stars 51 forks source link

Error: ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked #67

Closed connectwithub closed 4 years ago

connectwithub commented 4 years ago

I have implemented the owl carousel code as below as per the angular 9 guidelines. ` <owl-carousel-o [options]="customOptions"> <ng-template carouselSlide [id]="slide.id" *ngFor="let slide of slides">

  <ng-container *ngTemplateOutlet="template; context:{slide:slide}"></ng-container>
</ng-template>

` Everything renders fine but when i click, drag or even autoplay the slides it throws the following error image After some debugging i have traced back the error to Owl-Stage>ngStyle>transform function Have tried everything from custom navigation to auto navigation but nothing seems to work.

Angular Version: Anguar 9-rc-11 ngx-owl-carousel-0: 2.0.3

vitalii-andriiovskyi commented 4 years ago

Hi @connectwithub

I published v3.0.0 for the Angular 9. The implementation of the lib could be the same as for other previous versions of Angular. In my test projects, the lib works well.

connectwithub commented 4 years ago

Will give it a go and check

connectwithub commented 4 years ago

Still, the same issue is happening. It works for statically provided slide content but not dynamically provided via template

connectwithub commented 4 years ago

Update: if the content is wrapped in a div it starts to show up and work correctly like shown below <div> <ng-container *ngTemplateOutlet="template; context: { slide: slide, slideIndex: slideIndex }"></ng-container> </div>

But in my opinion, it should still work if provided directly or it should be mentioned in the docs atleast

TheCoderFish commented 3 years ago

@vitalii-andriiovskyi these needs to be addressed somewhere in the docs as @connectwithub mentioned. I could only land up here due to the expression has changed error or else would not have been able to find a solution