I have a Pipe just for Example that Squares the value that it receives this below one works fine
Template
<input type = "number" placeholder = "Enter number for which square is to be calculated" [(ngModel)] = "value">
<p>Squared Number is using pipe Transform {{value | square}} </p>
Component
value = 2;
Custom Pipe
import { Pipe,PipeTransform } from '@angular/core';
@Pipe({
name:'square'
})
export class SquarePipe implements PipeTransform{
transform(value: number, args?: number[]): number {
return Math.pow(value, 2);
}
}
But when i try to use the template like this
it doesn't work I need to know why ?
<input type = "number" placeholder = "Enter number for which square is to be calculated" #value>
<p>Squared Number is using pipe Transform {{value | square}} </p>
return value;intransform()? What do you mean with "local Template variable"? A template variable usually is<div #myTemplateVar></div>