Angular4 ngIf Uncaught Error: Template parse errors

Angular4 ngIf Uncaught Error: Template parse errors

我需要有关以下 if 语句的帮助。 如果 c.name = 'Pipe Systems' 那么 ng-template #PS 应该执行。 如果 c.name= "Bathroom and Drainage" 那么 ng-template #BD 应该执行。

我不断得到 "Uncaught Error: Template parse errors:"。无论我尝试什么,我都无法让简单的逻辑起作用,我是 angular 的新手,我无法解决这个问题,如果有人可以帮助我正确地构造我的 ngIf 以简单选择主要类别选项时过滤正确的 sub-category 选项。以下是我最近的失败尝试。

<div class="form-group">
      <label for="category">Category</label>
      <select id="category" class="form-control">
        <option value=""></option>
        <option *ngFor="let c of categories$ | async" [value]="c.key">
          {{ c.name }}
        </option>
      </select>
    </div>
    <div class="form-group">
      <label for="subcategory">Sub-Category</label>
      <select id="subcategory" class="form-control">
        <option value=""></option>
        <div *ngIf="c.name = 'Pipe systems'; then PS>
          <ng-template #BD>
            <option *ngFor="let s of subcategoriesBD$ | async" [value]="s.key">
              {{ s.name }}
            </option>
          </ng-template>
          <ng-template #PS>
            <option *ngFor="let s of subcategoriesPS$ | async" [value]="s.key">
              {{ s.name }}
            </option>
          </ng-template>
        </div>
      </select>
    </div>

Firebase 上的数据库如下:

可能是因为 =?, try:

<div *ngIf="c.name === 'Pipe systems'; then PS">