0

In Angular 9 I have code in that I want to hide html element. In typescript I have public property:

export class UserPageComponent implements OnInit {
  public postModel: any = {};

And in Html component I want to check if I should display html element:

<mat-video ng-if="postModel.moviePath != ''" src="{{ postModel.moviePath }}"></mat-video>

But element mat-video is always displayed. When I wanted to use ng-show the result is the same.

Robert
  • 2,571
  • 10
  • 63
  • 95

1 Answers1

0

You are using angularjs syntax, with angular it should be ngIf directive

<mat-video *ngIf="postModel.moviePath != ''" src="{{ postModel.moviePath }}"></mat-video>

Also there is NO ng-show with angular.

Sajeetharan
  • 216,225
  • 63
  • 350
  • 396