ionic-framework icon indicating copy to clipboard operation
ionic-framework copied to clipboard

Ionic2 (Beta 10) - Issue with ngFor and ion-slide

Open HamzaLJ opened this issue 10 years ago • 3 comments

I just updated to the latest Ionic2 version Beta 10. I had slides component working perfectly in the previous version I updated from Beta 7

Below is the code that was working fine in Beta 7 and stopped working in Beta 10:

  <ion-slides>
     <ion-slide *ngFor="let url of urls">
             <img class="imgSlide" src="{{url}}" />
     </ion-slide>
 </ion-slides>

I inspected in chrome dev tools to see what's wrong, what I discovered is that when ngFor="let url of urls" is placed inside ion-slide the style attribute shows the following style="width: 1.01408e+06px;"

After that I've been through some scenario so I can debug and check what's wrong exactly.

The first scenario I followed is the below one, it worked fine and printed the urls

   <ion-slides>
     <ion-slide>
         <div *ngFor="let url of urls">
               <h1 style="color:white;">{{url}}</h1>
         </div>
     </ion-slide>
   </ion-slides>

In the second scenario, I removed ngFor="let url of urls" from ion-slide and just generated the results in a static way (code below) and it worked fine:

  <ion-slides>
     <ion-slide>
             <img class="imgSlide" src="image1.jpg" />
     </ion-slide>
    <ion-slide>
             <img class="imgSlide" src="image2.jpg" />
     </ion-slide>
    <ion-slide>
             <img class="imgSlide" src="image3.jpg" />
     </ion-slide>
 </ion-slides>

I am really out of idea as I really can't figure out what's wrong, I believe that it's a bug related to the latest version Beta 10 as the same code was working before. I really hope that someone from the IONIC team replies ASAP.

Cordova CLI: 6.2.0 Ionic Framework Version: 2.0.0-beta.10 Ionic CLI Version: 2.0.0-beta.32 Ionic App Lib Version: 2.0.0-beta.18 ios-deploy version: 1.8.6 ios-sim version: 5.0.8 OS: Mac OS X El Capitan Node Version: v5.9.0 Xcode version: Xcode 7.3.1 Build version 7D1014

HamzaLJ avatar Jul 01 '16 01:07 HamzaLJ

Hello, thanks for opening an issue with us! Would you be able to provide a plunker that demonstrates this issue? Thanks for using Ionic!

jgw96 avatar Jul 01 '16 08:07 jgw96

+1 on this issue. With make a post about this later

jgrxl avatar Jul 01 '16 16:07 jgrxl

Hello all! As it seems it has been a while since there was any activity on this issue i will be closing it for now. Feel free to comment if you are still running into this issue. Thanks for using Ionic!

jgw96 avatar Jul 07 '16 19:07 jgw96