Ionic trim 0 and dot from decimal


#1

Hi,

I have a data 0.34 I want to output it into 34

<ion-content>
<p>0.34</p>
</ion-content>

#2
let item = '0.34';
let newValue = item.split('.')[1];

#3

How can I do it if it’s coming from API?

<ion-content *ngFor="let data of datas">

<p>{{ data.sThreePointersPercentage }}</p>

</ion-cotent>

output: 0.340


#4
let item =  data.sThreePointersPercentage.toString();
let newValue = item.split('.')[1];

#5

I update my answer right now

<ion-content *ngFor="let data of datas">

<p>{{ data.sThreePointersPercentage }}</p>

</ion-cotent>

output: 0.340


#6

@avishai_peretz_dev thanks

    removezero(data) {
    let item =  data.sThreePointersPercentage.toString();
    let newValue = item.split('.')[1];
    return newValue;
    }