0

I need to do something like depending on the Type property of an object, render a different component: My pipe returns a specific element Can I assign to a template variable an expression?

Simplest way to do this?

Thanks in advance

  <ng-template let-data="contentArray | pipeFilter:val" >


            <div [ngSwitch]="data?.Type">
              <input *ngSwitchCase="'TextBox'"  />

              <span *ngSwitchDefault ></span>
            </div>

    </ng-template>
CREM
  • 1,929
  • 1
  • 25
  • 35
  • I have more than 8 types of components to conditionally render, i wrote just an example – CREM Aug 21 '17 at 21:56

1 Answers1

0

Try using the interpolation {{}} to evaluate the expression.

ronakvp
  • 177
  • 3
  • 11