Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ionic Binding Number to Button

I'm looking for a way to bind numbers to buttons. For example, when you press 1 on a calculator, the number '1' is bound to it and displays on a monitor. Is there any way I can attach the number 1 to a button in Ionic?

Thanks

like image 253
Justin Chu Avatar asked Jan 30 '26 05:01

Justin Chu


1 Answers

You mention typescript so its ionic-2 i guess,I suggest to use angular way of binding.

first declare variable in typescript file

file.ts

displayNum:any;

for displaying

file.html

<button ion-button>{{displayNum}}</button>
like image 199
codeMonkey Avatar answered Feb 01 '26 20:02

codeMonkey