Hello to all,
tell me anyone whats the wrong in my code, i have to set default image while response not received i am using placeholder but not working?
I check this doc and now check my below binding this is correct or not?
<img bind-src=“userProduct.ImageCollection[0].url != null ? userProduct.ImageCollection[0].url :‘assets/imgs/kids-party.jpg’”;
userProduct.ImageCollection is get from the firestore and myImgUrl is our default image URL and if resposne is not received from Fb we have to show default image?
my english is not the best., so sorry for that, if I understand something wrong.
I guess you get a path/url string from whatever. If you bind in html a variable/methode to .ts, then angular is doing the rest for you.
[anyproperty]=‘anyvariable’ updates html, when anyvariable change.
(click)=‘anyMethode()’ is execute if you clickin html on it.
[(ngModel)]=“userName” is used for inputs and is both way.
setTimeout( ()=> { // only for delay
img.src = this.mainImage;
}, 5000 )
// can use like this
// img.addEventListener('load', l => {
// this.showedImage = this.mainImage;
// //remove listener after load
// });
// or use like this
img.onload = () => {
this.showedImage = this.mainImage;
}