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

Ionic 2 rc3 image lazy load

Open ykonstant opened this issue 9 years ago • 3 comments

I have many images cards on dashboard, that fluctuating images,

<ion-card class="custom" *ngFor="let post of posts" tappable (tap)="post.type == 3 ? detailPage($event,post) : ''"> <div class="dashbg" [ngStyle]="{'background-image': 'url(' + bs.setImage(post.image, 'trip', 'trip') + ')'}">

<div class="img" [ngStyle]="{'background-image': 'url(' + bs.setImage(post.picture, 'profile_pictures') + ')'}">

                <ion-avatar item-right class="customb" *ngIf="post.going_picture != ''">
                    <div class="img" [ngStyle]="{'background-image': 'url(' + bs.setImage(post.going_picture, 'profile_pictures') + ')'}"></div>
                </ion-avatar>
                <h2 class="post-title">{{post.title}}</h2>
                <p class="post-address" *ngIf="post.type == 3 ">
                    <ion-icon class="custom" name="md-pin"></ion-icon>
                    {{post.address}}
                </p>
            </ion-item>
        </ion-card>

We already use ng2-lazyload-image, but it not working properly.... Can any one provide a example for this, in , as we can not use [virtualScroll] in .

ykonstant avatar Dec 06 '16 05:12 ykonstant

@ykonstant thats rather more an Forum request then an issue. I've added myself a image-loading-component (rather offline-caching). In Angular2 you need to bypass the security: import {DomSanitizer} from '@angular/platform-browser'; private sanitizer: DomSanitizer obj.IMAGE_SRC = this.sanitizer.bypassSecurityTrustUrl(obj.IMAGE_URL); And then you can set the src: [src]="obj.IMAGE_SRC"

graphefruit avatar Dec 06 '16 13:12 graphefruit

Hello! Thanks for using Ionic! While this is a support issue which should be taken to our forum or slack channel I will say that we have some very cool stuff coming up with ion-img that I think your gonna like! 😉

jgw96 avatar Dec 06 '16 16:12 jgw96

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

ionitron-bot[bot] avatar Sep 06 '18 01:09 ionitron-bot[bot]