transform int to decimal number by Angular

121 Views Asked by At

Hello I tried to transform the price int to decimal number. for exemple : 900 -> 9,00 or 950 -> 9,50

I tried diverse number like I saw in this platforme but it always shows 900 or 900,00. not 9,00 like I want.

my code :

    <ul>
        <li><img src={{product.picture}} /></li>
        <li class="padding font">{{product.title}}</li>
        <li class="padding">{{product.price| number :'2.0-2'}} €</li>
    </ul>

right here -> {{...|number : ''}}

<mock.ts>

export const PRODUCTS: IProduct[] = [
  {
    id: 1,
    category: "pizza",
    title: "Pizza Chicken",
    description:
      "Base crème fraîche, mozzarella, poulet fumé et pommes de terre.",
    price: 900,
    picture: "assets/img/pizza-chicken.png",
    includedIngredients: [
      {
.......

i want to put the decimal number like this : 9,50

1

There are 1 best solutions below

0
Nikita On
{{product.price/100| number :'1.0-2'}}