how can I check if an element is not undefined with a hidden-block, i.e. how can I write the following code with a hidden-block
<div *ngIf="timeSlot.track">
I tried something like this
<div [hidden]="!timeSlot?.track">
but it's not the same.
I hope somebody can help.
THX
CodePudding user response:
In alternative you can try to use shorthand inside hidden directive:
<div [hidden]="timeSlot.track === undefined ? true : false">
CodePudding user response:
In HTML File
<div [hidden]="isHidden()">
In .ts File
isHidden() {
if(this.timeSlot.track === undefined) {
return true;
}
return false;
}