Does Aurelia
optional binding support ? I can not find this information anywhere. The problem I am facing is that I have an attribute title
that may or may not be populated in an array of objects. I use repeat.for
and title.bind
, but I do not want the attribute to exist at all if this property is not part of an array of objects. Is this possible in Aurelia
?
When used Bootstrap-Select
with an empty one, title
it throws an error. If you Aurelia
create the attribute on the fly, this will solve my problem.
The code I still have is as follows:
<select class="selectpicker" value.bind="value" options.bind="options" disabled.bind="disabled">
<option repeat.for="option of options" model.bind="option"
data-subtext.bind="option.subtext"
title.bind="option.title">
${option.name}
</option>
In this example, I wanted to do data-subtext
, and title
additional attributes. Is this doable?
Since this is a user element, I tried to remove the property of title
my object delete this.element.title
, but this does not work. I also tried with jquery but again no luck.
source
share