twitter-bootstrapdurandal

Bootstrap in Single Page App


I'm building a Single Page Web App and want to use bootstrap UI components. My understanding is that bootstrap script runs in page load and checks the classes applied to html tags and converts them into bootstrap controls. If I'm building a single page app with view composition (like Durandal), and want to run Bootstrap after the view is composed in the DOM, how do I do that? I want to keep declarative syntax in html (i.e. apply bootstrap classes like dropdown), and I don't want to call .dropdown() function on the DOM element explicitly.

Thanks


Solution

  • Have you tried this? My experience is that it actually works right out of the box. I have been working on a number of SPA apps and they work absolutely fine.

    The Durandal sample project also uses Bootstrap for its UI if you want to download that and take a look.

    Bootstrap makes use of the JQuery "On" handler to ensure that dynamic dom content added later on after the page has finished initially loaded is handled and bound correctly.