Thursday, 25 April 2024

Pipes to sum price

  transform(quantity: number, unitprice: number): any {

    if (isNaN(quantity) || quantity === null) return ''; // Handle non-numeric values
    if (isNaN(unitprice) || unitprice === null) return '';
    // Round the number to the specified decimal places
    // const roundedValue = Number(value.toFixed(decimalPlaces));
      const exitprice=quantity * unitprice;
        return exitprice
  }



Here based on two fields data should update.
so writen pipe
in html given pipe like this
[value]='orderItemObj.Quantity | exitprice:orderItemObj.UnitPrice' for input
firstvalue ,pipe,second value.







No comments:

Post a Comment

Car pooling app

 I'll create a car pooling app with real-time vehicle tracking, pickup/drop time estimates, and a list of onboard users. Since we don...