Limit to 2 decimal places with a simple pipe

后端 未结 4 559
难免孤独
难免孤独 2020-12-13 23:10

I have found an example which limits a number to 2 decimal places AND turns the figure into a currency amount- eg £2.55.

{{ number | currency : \'GBP\' : tru         


        
4条回答
  •  情深已故
    2020-12-13 23:36

    Simple solution

    {{ orderTotal | number : '1.2-2'}}
    
    //output like this
    
    // public orderTotal = 220.45892221
    
    //   {{ orderTotal | number : '1.2-2'}} 
    
    // final Output
    //  220.45
    

提交回复
热议问题