Skip to content

Commit

Permalink
fix for double binding.
Browse files Browse the repository at this point in the history
  • Loading branch information
damiandennis committed Apr 17, 2015
1 parent c68e5f7 commit 9d809d5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 2 additions & 2 deletions build/knockout-bootstrap.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions src/knockout-bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ function setupKoBootstrap(koObject, $) {
y: button.outerHeight()
};

koObject.cleanNode(popoverEl[0]);
if (data) {
koObject.applyBindings({template: template, data: data}, popoverEl[0]);
}
Expand Down Expand Up @@ -261,10 +262,16 @@ function setupKoBootstrap(koObject, $) {
modal.html($('#'+template).html());
}

// As modal is not destroyed we want the data to be up to date.
var original = modal.html();

modal.modal(options);

$element.on('click', function() {

//replace modal with original template and clean node and initialize with new data.
modal.html(original);
koObject.cleanNode(modal[0]);
if (data) {
koObject.applyBindings({
template: template,
Expand Down

0 comments on commit 9d809d5

Please sign in to comment.