How to add custom property to Ionic Component?


<button ion-button [myProperty]="foo">

I need a property like myProperty that gives to the button other dynamic properties such as:

  • if foo is greater than 100 the button will be disabled.
  • if foo is less than 0 the button click event will be overwritten.

(It is necessary since it needs to be applied on many buttons)

What is the best way to solve this?

In Ionic4, you would use a @Input() myProperty; in your .ts file. Not sure about ionic 3, but perhaps it is the same.