Boolean inputs to angular 2 component

This fails, because the usage <generic-selector showControls="false"></generic-selector> sets showControls as the
string “false”, which is truthy, rather than as the boolean value. So
I have to get round it by adding a lot of mess to the component to
take in the input and convert to a boolean based on whether it is
being given the string “false” or not. A non-messy way to sort this
would be appreciated, but I’d prefer being able to do the other option
above.

using binding

<generic-selector [showControls]="false"></generic-selector>

Leave a Comment

File not found.