I've created a custom element that wraps an input element. I'd like to have the
optional ability to pass a placeholder parameter, and if it's present, to set the placeholder attribute. But for some uses I don't want to include a placeholder.
e.g. referencing
<ui-input params="valueObs: someObs, placeholder: 'Label'"></ui-input>
then in the component
<input type="text" data-binding="attr:{placeholder: placeholder}, textInput: valueObs"/>
This throws an error if the placeholder parameter isn't provided. Trying to default in the data-binding doesn't seem to work as the reference to placeholder is itself not there. Is it possible to do something like this, or do I have to add placeholder to all existing references to the ui-input element?
I have may elements that could well use some strategy for having optional parameters like this.
Thanks in advance,
Alx