These are chat archives for angular/angular-2-ionic-2

17th
Feb 2017
abhimunna
@abhimunna
Feb 17 2017 13:58 UTC
Hi, I have an issue of getting images using "src", I have placed my image in "img" folder which is in "www" folder, and i am trying to get it like this <ion-img style="width: 80px; height: 80px;" src="img/img2.png"></ion-img>, can anyone help me to solve this issue
Andrew Graham-Yooll
@andrewgy8
Feb 17 2017 14:49 UTC
@abhimunna Your image folder should be in src/assests/
And in your img tag you use the path src="assets/img/path-here
@pedrocortizo Found this so post for google plus profile pics
abhimunna
@abhimunna
Feb 17 2017 15:30 UTC
thanq @andrewgy8 for reply, i have accessed file source but image was not displaying.
Andrew Graham-Yooll
@andrewgy8
Feb 17 2017 15:31 UTC
Whats the path?
And how are you writing it in your template?
abhimunna
@abhimunna
Feb 17 2017 15:33 UTC
as per your suggestion i have placed an img folder in src, assets folder and image name is audi1 and template will be written like this <ion-img style="width: 80px; height: 80px;" src="assets/img/audi1"></ion-img>
Andrew Graham-Yooll
@andrewgy8
Feb 17 2017 15:33 UTC
use <img src="assets/img/audi1" />
As per the docs: 'A good rule is, if there are only a few images to be rendered on a page, then the standard img is probably best."
And for your styles, I reccomend puting them into your .scss file. It makes your template cleaner and you can avoid having to recompile your code while tweaking the styles if needed.
Andrew Graham-Yooll
@andrewgy8
Feb 17 2017 15:44 UTC
And 'Note: ion-img is only meant to be used inside of virtual-scroll'