Getting the value of a mat-panel in ngIf?

I’m trying to use angular’s ngIf to check what the title of my mat-panel box is before applying some changes to the content.

<mat-expansion-panel-header id="head">
      <mat-panel-title>
        Demo1
      </mat-panel-title>
      <img class="panel-image" src="assets/demo.png">
</mat-expansion-panel-header>

<mat-expansion-panel-header id="head">
      <mat-panel-title>
        Demo2
      </mat-panel-title>
      <img class="panel-image" src="assets/demo.png">
</mat-expansion-panel-header>

Since both headers are generated by ngFor, is there is a way that I can check which header is which using ngIf before generating the body content of the panel? Like

<ngIf title===Demo>
    <mat-card **apply this**/>

The reason I want to do this is because I want to generate both the headers and the content using ngFor. The headers can be generated in the same way, but the content is very different so it needs to check which header it is being placed under. Is this possible using ngIf?

Source: Angular Material Quesions