ngx-material-keyboard / core

Onscreen virtual keyboard for Angular ≥ 5 (https://angular.io/) using Angular Material (https://material.angular.io/).
https://ngx-material-keyboard.github.io/core/
98 stars 120 forks source link

Make keyboard attribute dynamic #9

Closed mmeendez8 closed 7 years ago

mmeendez8 commented 7 years ago

Hi, I have been trying to make the attribute variable and show the keyboard only under certain conditions but I cannot make it work. This is a simple example of what I have tried using attribute binding:

[attr.mdKeyboard] = "disabled ? '' : null "

Any help would be appreciated!!

davidenke commented 7 years ago

What you're doing here is setting an HTML attribute. But mdKeyboard is an attribute directive (https://angular.io/guide/attribute-directives).

The simplest way would be to use *ngIf: https://stackoverflow.com/a/44631715/1146207