AngularLiveLessons icon indicating copy to clipboard operation
AngularLiveLessons copied to clipboard

Question: Is there a way to still have the use of default photo if none is available, but still use *ngIf binding?

Open Tanker21 opened this issue 5 years ago • 0 comments

I kind of liked having a default photo if none was added to a recipe, but still want to use the class binding that contains the img tag. I see that *ngIf can handle an if...else, but I cannot seem to get it to work. I tried:

and also:

)

but keep getting this error:

Error: src/app/components/recipe-summary/recipe-summary.component.html:4:41 - error NG5002: Parser Error: Unexpected token / at column 50 in [recipe.cover_photo; then recipe.cover_photo else /assets/emptybowl.jpg] in D:/Documents/Learning/Web/Angular/recipes/src/app/components/recipe-summary/recipe-summary.component.html@3:40

4 <div class='cover-photo-holder' *ngIf="recipe.cover_photo; then recipe.cover_photo else /assets/emptybowl.jpg">

Tanker21 avatar Nov 20 '20 01:11 Tanker21