binding: Binding to array element fails if members are base types instead of objects
@darkelyte posted this as an issue: https://gist.run/?id=ce4f511fd3c40cda9f93c05c4f869e52
export class App {
items = ["first", "second", "third"];
}
<ul>
<li repeat.for="item of items">${item}</li>
</ul>
<p repeat.for="item of items">
<input value.two-way="item"
</p>
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 22 (10 by maintainers)
We can add a grouping, similar to Binding and Templating, that is dedicated to Recipes. We can include various articles in multiple sections. So, we could have the binding recipes under the Binding group, but also have them appear under the Recipes group, for example. In that way, whether the reader goes looking for help about binding or goes looking for a recipe, they can easily find that content. We’re doing a bit of work on our nav content structure now, so when that’s done (which it almost is) this should be a piece of cake to implement.
As a user of the framework, while I wouldn’t expect this to work:
… I would hope that the binding system would get around that limitation. If the answer is simply, “it doesn’t”, then so be it. Though I’d then like to open an enhancement request for this functionality if it is at all feasible.
Sorry, I must be missing something obvious here. We have an array of strings ‘items’ off the VM, and the UI wants to bind to the first item of that array. Why would you not expect
${items[0]}
to work, and what might an alternative approach be? It seems to me that this is an incredibly common scenario, hence why I’m asking if I’m missing something.