I have an issue and I cant seem to figure it out, basically I'm trying to use a ternary if statement in a [src] attribute in angular
<img class="author-head" [src]="(asset.fields.authorHeadImage != null || asset.fields.authorHeadImage != undefined ) ? asset.fields.authorHeadImage?.fields?.file.url : ../../../../assets/Images/CustomContent/author.jpg" >
basically what Im trying to do here is if asset.fields.authorHeadImage is null or asset.fields.authorHeadImage is undefined show this predetermined image but if there is an authorHeadImage then use that image src..
but I keep getting these massive errors in my console that dont really mean anything?
Any help would be appreciated
Thanks
EDIT
I switched the operators around and now Im getting this error it says I have an unexpected fullstop at column 136 but there are no rogue fullstops?
Parser Error: Unexpected token . at column 136 in [(asset.fields.authorHeadImage != null || asset.fields.authorHeadImage != undefined) ? asset.fields.authorHeadImage?.fields?.file.url : ../../../../assets/Images/CustomContent/drsultan.jpg] in ng:///MainModule/ProgramItemComponent.html@5:37 ("
<div *ngIf="asset.fields.showAuthorHead === true">
<img class="author-head" [ERROR ->][src]="(asset.fields.authorHeadImage != null || asset.fields.authorHeadImage != undefined) ? asset.fi"): ng:///MainModule/ProgramItemComponent.html@5:37
Parser Error: Unexpected token . at column 136 in [(asset.fields.authorHeadImage != null || asset.fields.authorHeadImage != undefined) ? asset.fields.authorHeadImage?.fields?.file.url : ../../../../assets/Images/CustomContent/drsultan.jpg] in ng:///MainModule/ProgramItemComponent.html@5:37 ("ile.url : ../../../../assets/Images/CustomContent/drsultan.jpg" >