faulknercs / Knockstrap

Knockout bindings to twitter bootstrap 3
faulknercs.github.io/Knockstrap/
MIT License
142 stars 37 forks source link

Issue with Alerts when you try to re-use the same alert as a template #29

Closed olalawal closed 9 years ago

olalawal commented 9 years ago

The previous alert css class is not removed when you try and use the same alert using something like this template for hiding and showing the alert div :

I fixed the issue in the binding handler by modifying the code adding a new remove class line to remove prior rendered alerts in the Alert binding handler right before the addClass line.

            //ola lawal added this code to removeclassess for resulable alerts using hide show
            $element.removeClass("alert-info alert-danger alert-success ");

            $element.addClass('alert fade in').addClass('alert-' + (ko.unwrap(value.type) || 'info'));