Skip to content
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

Reset a binding before updating it? #727

Open
rejhgadellaa opened this issue Apr 29, 2018 · 0 comments
Open

Reset a binding before updating it? #727

rejhgadellaa opened this issue Apr 29, 2018 · 0 comments

Comments

@rejhgadellaa
Copy link

rejhgadellaa commented Apr 29, 2018

Is there a way to 'reset' a binding before updating it?

For example, if I have this:

{data: { image: "someimage.jpg" }}
<img rv-src="data.image" />

it produces this after binding:

<img rv-src="data.image" src="someimage.jpg" />

But when I update the model with this:

{data: { image: "some-other-image.jpg" }}

the old image is still in place until the browser loaded the new image.

I'm also having an issue where attributes that I add don't get cleared out when updating:

<img rv-src="data.image" />

Becomes:

<img rv-src="data.image" src="someimage.jpg" />

Then, I add an attribute through javascript:

<img rv-src="data.image" src="someimage.jpg" data-custom-attr />

But when I update the model it still has the attribute (without me adding it):

<img rv-src="data.image" src="some-other-image.jpg" data-custom-attr />

What I want is rivets to use the template I initially used to bind the data, not what's currently in the DOM (because I may need to change that).

I hope the above is clear enough..?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant