title: angular - declare result of pipe as local variable
body: <p>I'm using ngx-pipe's percentage pipe twice in a label. Once to determine which color class (success or info) and once to display the percentage.</p>
  
  <pre><code>&lt;label class="label" [ngClass]="(item.amount |
  percentage:item.total) &gt;= 100 ? 'label-success' : 'label-info'"&gt;Progress {{item.amount | percentage:item.total:true}}%&lt;/label&gt;
  </code></pre>
  
  <p>Is there a way that I can store the result of that pipe as a local template variable only once like</p>
  
  <pre><code>&lt;label class="label" #percent="(item.amount |
  percentage:item.total)" [ngClass]="percent &gt;= 100 ? 'label-success' : 'label-info'"&gt;Progress {{percent}}%&lt;/label&gt;
  </code></pre>
  
  <p>I know you can store it inside an *ngIf or *ngFor directive like</p>
  
  <pre><code>&lt;div *ngIf="item$ | async as item"&gt;
  </code></pre>
  
  <p>or</p>
  
  <pre><code>&lt;div *ngIf="item$ | async; let item"&gt;
  </code></pre>
  
  <p>Is there a similar approach to my issue?</p>