Bacancy Technology
Bacancy Technology represents the connected world, offering innovative and customer-centric information technology experiences, enabling Enterprises, Associates and the Society to Rise™.
12+
Countries where we have happy customers
1050+
Agile enabled employees
06
World wide offices
12+
Years of Experience
05
Agile Coaches
14
Certified Scrum Masters
1000+
Clients projects
1458
Happy customers
Artificial Intelligence
Machine Learning
Salesforce
Microsoft
SAP
May 18, 2023
For showing values up to 2 decimal places, you can use the number pipe offered by Angular.
<input type="text" name="whatever" value="{{ model.Rate | number : ‘1.2-2’ }}" /> Or <input type="text" name="whatever" value="{{ model.Rate | number : ‘1.0-2’ }}" />
The number pipe follows the following convention.
{{ Value | Number : ‘ {minIntegerDigits}.{minFractionDigits}-{maxFractionDigits} ‘}}
Here,
Since we require only 2 digits after the decimal, we can use the pipe as “number: 1.2-2”.
We set the minFractionDigits to 2 and maxFractionDigits to 2. So a value like 100 will be displayed as 100.00, and values like 100.1234 will be displayed as 100.12.
If you don’t want to see the value as 100.00, you can set the minFractionDigits to 0.
For example, {{ value | number : ‘1.0-2’ }}
You can refer to the decimal pipe docs for more information https://angular.io/api/common/DecimalPipe.