faulknercs / Knockstrap

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

Multiple Alerts with option to auto timeout #21

Closed bradbamford closed 9 years ago

bradbamford commented 9 years ago

Is it possible to add multiple alerts to the page and also have them auto timeout instead of having a close (X) button.

Using the following bindings, when a user clicks X, it's gone forever, and you can't use it again.

<div data-bind="alert: { message: notify().message, type: notify().type}"></div>

<scrip-t type="text/html" id="alertTemplate"> <p data-bind="text: notify.message()"></p> <button class="btn btn-primary" data-dismiss="alert">Close</button> </scrip-t>

Is it possible to add multiple alerts to the page, and reuse the same div binding?

faulknercs commented 9 years ago

Hello, Default alert template provides similar with native bootstrap alerts behavior for close buttons. If you want to hide alerts, you should provide custom template and specify your methods for hiding/showing. See example: http://jsfiddle.net/faulknercs/jq5L31w0/ Hope, this help you.

bradbamford commented 9 years ago

Thanks for the fiddle, that was helpful, I guess I need to work out an ObservableArray that uses the altertTemplate in order to have more than one display at a time.