How to create a backspace button in ionic

I want to create a backspace button in ionic when clicking on that button the length of the string should reduce by one…

I tried the following–

clear()
{

this.value=this.value.length-1;
}

but in this case the output is the length of the value minus one,
like if input is 123 ,I am getting output on clicking the button as 2(length=3-1)
as ,my output…
Please help if anyone has tried this out…
Thanks,

.lenth measures the length of stuff. You have to use the calculated valued to cut string in length.

How can i do this… Please elaborate…

this.value = this.value.substr(0, this.value.length-1);
1 Like

Thanks a lot…it works fine :slight_smile: