New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
oneTime binding behavior breaking in a changing collection #301
Comments
What does it show instead? |
It shows: |
I think the excepted behaviour with |
I don't understand this logic. I want a list of divs with each div binding oneTime to it's underlying viewmodel property. If I replace the list of data, there should be brand new divs (along with brand new viewmodels as it is a new list)...the oneTime should only apply to that specific view/viewmodel/property, not to the index in the list. Every other databinding framework I have used works the way I am talking about with a oneTime binding. Otherwise, you could never use a oneTime binding to, for example, a text value inside a list in your application if that list could ever be changed, for example by sorting or filtering. If the individual item properties change, then sure, one-time binding shouldn't be expected to work, but that isn't what I'm talking about. |
http://aurelia.io/docs.html#/aurelia/framework/latest/doc/article/cheat-sheet/5 explains the 3 types of binding in Aurelia. What you want is probably |
One-way gets dirty checked and removes a bunch of optimizations that one-time gets. One-time usually means the property you are binding to is immutable, which is the case I am talking about. |
And just to show I'm not crazy, this does work:
This shows: It just doesn't work if the div contains more than one one-time binding in the string template |
I think it's a legitimate bug. @jdanyow @martingust Can you guys look into this? |
Just checking to see if this is still being worked on...? |
@jdanyow Can you look at this? |
sorry guys- I assigned this to myself and then forgot all about it. It seems to be specific to interpolation bindings, this template works as expected: <template>
<button click.trigger="clickme()">Click me!</button>
<div repeat.for="item of items">
<span textcontent.one-time="item.prop1"></span>
<span textcontent.one-time="item.prop2"></span>
</div>
</template> will get a fix in shortly. |
This is not working as expected, the screen should show:
4 4
5 5
after clicking the button.
welcome.html
welcome.js
The text was updated successfully, but these errors were encountered: