1

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

3
  • 1
    if your price is $9, it should be stored: price: 9.00, not price: 900, Commented Feb 21, 2023 at 20:40
  • by the way, in all coding languages, keep in mind . is used for decimal, not , Commented Feb 21, 2023 at 20:41
  • its recommended to write int in mock and transform after. In Europe we use "," instead of ".". Commented Feb 21, 2023 at 21:28

1 Answer 1

0
{{product.price/100| number :'1.0-2'}}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.