Skip to content

Instantly share code, notes, and snippets.

@LucasCalazans
Last active March 10, 2023 02:17
Show Gist options
  • Save LucasCalazans/0126da828e4475313fd375bdfc6ba633 to your computer and use it in GitHub Desktop.
Save LucasCalazans/0126da828e4475313fd375bdfc6ba633 to your computer and use it in GitHub Desktop.
Refresh bindings for a knockout component
$('#btn').on('click', () => {
$.get('https://app.magento.localhost/test/index/index').done(result => {
$('#container').replaceWith($(result).find('#container'));
$('body').trigger('contentUpdated');
ko.cleanNode($('.column.main')[0]);
$('.column.main').applyBindings();
})
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment