Curran Kelleher has a couple of videos and and excellent little website called 50 AngularJS examples, with tiny but complete HTML code illustrating each example. The first few are pure HTML and jQuery-less DOM manipulation, then the rest to go into AngularJS with a little Backbone for comparison. You can even navigate through examples using arrow keys. An excellent means of presenting information I’m thinking about stealing!

The two videos don’t have any table of contents, so I created one:

Part 1

Example 1

https://www.youtube.com/watch?v=TRrL5j3MIvo#t=691

 

Example 2

https://www.youtube.com/watch?v=TRrL5j3MIvo#t=725

 

Example 3

https://www.youtube.com/watch?v=TRrL5j3MIvo#t=790

 

Example 4

https://www.youtube.com/watch?v=TRrL5j3MIvo#t=812

 

Example 5

https://www.youtube.com/watch?v=TRrL5j3MIvo#t=852

 

Example 6

https://www.youtube.com/watch?v=TRrL5j3MIvo#t=890

 

Example 7 (First AngularJS example) Introduces angular, discusses cdnjs.com

https://www.youtube.com/watch?v=TRrL5j3MIvo#t=1032

 

Example 8

https://www.youtube.com/watch?v=TRrL5j3MIvo#t=1256

 

Example 9

https://www.youtube.com/watch?v=TRrL5j3MIvo#t=1291

 

Example 10

https://www.youtube.com/watch?v=TRrL5j3MIvo#t=1317

 

Example 11

https://www.youtube.com/watch?v=TRrL5j3MIvo#t=1457

 

Example 12: Fascinating discussion of how AngularJS propagates values

https://www.youtube.com/watch?v=TRrL5j3MIvo#t=1548

 

Example 13

https://www.youtube.com/watch?v=TRrL5j3MIvo#t=1642

 

Example 14

https://www.youtube.com/watch?v=TRrL5j3MIvo#t=1725

 

Example 15

https://www.youtube.com/watch?v=TRrL5j3MIvo#t=1822

 

Example 16

https://www.youtube.com/watch?v=TRrL5j3MIvo#t=2004

 

Example 17

https://www.youtube.com/watch?v=TRrL5j3MIvo#t=2030

 

Example 18

https://www.youtube.com/watch?v=TRrL5j3MIvo#t=2266

 

Example 19

https://www.youtube.com/watch?v=TRrL5j3MIvo#t=2345

 

Example 20

https://www.youtube.com/watch?v=TRrL5j3MIvo#t=2402

 

Example 21

https://www.youtube.com/watch?v=TRrL5j3MIvo#t=2547

 

Example 22

https://www.youtube.com/watch?v=TRrL5j3MIvo#t=2722

 

Example 23

https://www.youtube.com/watch?v=TRrL5j3MIvo#t=2831

 

Example 24

https://www.youtube.com/watch?v=TRrL5j3MIvo#t=2872

 

Example 25

https://www.youtube.com/watch?v=TRrL5j3MIvo#t=2932

 

Example 26

https://www.youtube.com/watch?v=TRrL5j3MIvo#t=3052

 

Example 27

https://www.youtube.com/watch?v=TRrL5j3MIvo#t=3161

 

Example 28

https://www.youtube.com/watch?v=TRrL5j3MIvo#t=3290

 

Example 29

https://www.youtube.com/watch?v=TRrL5j3MIvo#t=3331

 

Example  30

https://www.youtube.com/watch?v=TRrL5j3MIvo#t=3345

 

Example 31

https://www.youtube.com/watch?v=TRrL5j3MIvo#t=3380

 

Example 32

https://www.youtube.com/watch?v=TRrL5j3MIvo#t=3453

 

Example 33, Routing (says Example 32)

https://www.youtube.com/watch?v=TRrL5j3MIvo#t=3469

 

Example 34

https://www.youtube.com/watch?v=TRrL5j3MIvo#t=3489

 

Example 35

https://www.youtube.com/watch?feature=player_detailpage&v=TRrL5j3MIvo#t=3771

 

Part 2

Example 36

https://www.youtube.com/watch?feature=player_detailpage&v=6J08m1H2BME#t=467

 

Example 37

https://www.youtube.com/watch?feature=player_detailpage&v=6J08m1H2BME#t=555

 

Example 38

https://www.youtube.com/watch?feature=player_detailpage&v=6J08m1H2BME#t=712

 

Example 39

https://www.youtube.com/watch?feature=player_detailpage&v=6J08m1H2BME#t=821

 

Example 40

https://www.youtube.com/watch?feature=player_detailpage&v=6J08m1H2BME#t=1069

 

Example 41

https://www.youtube.com/watch?v=6J08m1H2BME#t=1224

 

Example 42

https://www.youtube.com/watch?v=6J08m1H2BME#t=1319

 

Example 43

https://www.youtube.com/watch?v=6J08m1H2BME#t=1468

 

Example 44

https://www.youtube.com/watch?v=6J08m1H2BME#t=1666

 

Example 45

https://www.youtube.com/watch?v=6J08m1H2BME#t=1810

 

Example 46

https://www.youtube.com/watch?v=6J08m1H2BME#t=2137

 

Example 47 (introduced while on Example 46)

https://www.youtube.com/watch?v=6J08m1H2BME#t=2731

 

Example 48

https://www.youtube.com/watch?v=6J08m1H2BME#t=2821

 

Example 49

https://www.youtube.com/watch?v=6J08m1H2BME#t=3110

 

Example 50

https://www.youtube.com/watch?v=6J08m1H2BME#t=3186

The only thing better than a Bootstrap-styled user interface is a wizard written using Bootstrap.js, and Vincent Gabriel’s oh-so-capable Twitter Bootstrap Wizard Plugin lets create one quickly and easily. What I wanted was a step-by-step wizard with a lot of features:

  • Customizable Previous and Next buttons
  • A Customizable Finish button
  • Support for an arbitrary number of steps
  • A progress bar

Here’s what the sequence should look like visually:

Twitter Bootstrap Wizard Example Step 1.

Twitter Bootstrap Tutorial Screen Shot 1

 

Note how in Step 1 the First and Previous buttons are disabled, as they should be. You can use class and style  attributes to modify default behavior.

Twitter Bootstrap Wizard Example Step 2.

Twitter Bootstrap Tutorial Screen Shot 2

In Step 2 the First and Previous buttons have automatically become active.

Twitter Bootstrap Wizard Example Step 3.

Twitter Bootstrap Tutorial Screen Shot 3

In Step 3 the Finish button has automatically been replaced with a Done button. The default behavior for the Done button is to appear as disabled, but that behavior is easily modified using a bit of jQuery.

I think Bootstrap has changed in such a way that Vince’s code no longer works as written with the current version. At least I couldn’t get it to work, but I’m pretty sure that’s more a reflection on me than Vince. Not being a Bootstrap expert I had to go back to first principles and understand their tab markup, then add Vince’s good work on top of that.

By the way, I try to include running code here through the use of CDNs, but the Twitter Bootstrap Wizard Plugin isn’t available on cdnjs, even though it appears to be.

Here’s the complete running program.

Assumptions for the Twitter Bootstrap Wizard tutorial:

Since I don’t have a demo, here’s the complete code listing before I get into the explanation.

 

Step by step Markup Tutorial for a Bootstrap Wizard With Progress Bar

 

0. Create a surrounding div

The whole thing must be surrounded by a simple div with an ID you assign the name of the wizard, rootwizard in this example:

 

1. Tab markup: Unordered list

      • The markup for the tabs themselves is an unordered list with class="nav nav-tabs" role="tablist" in the ul
      • Each tab is in an li tag with a unique named anchor on the same page, for example, a href="#step2"
      • The li tag must use data-toggle="tab" attributes. FWIW I was able to omit the role="tab" but that seems like a bad thing for forward compatibility.

2. Progress bar markup: div of class “progress” and nested div of class “progress-bar”

  • Create a div of class “progress”. It doesn’t need an ID
  • Inside it nest a div of class “progress-bar”. It requires an ID, in this case, I used progressBar. jQuery will be used to update the div dynamically as the user clicks Previous and Next buttons and it needs the ID to know which div to work on.

The “progress-bar-striped” attribute is optional. It looks more dynamic and gives the user a feeling of real progress while filling out a form.

I put the progress bar just below the tabs but it can go anywhere. For example, it looks just as good if you switch steps 2 and 3.

3. Tab pane markup: div of class “tab-content” with nested divs of class “tab-pane”

The tab panes are where content goes. You can only see one at a time, even though they’re all in a single piece of markup.

      • Create a div of class “tab-content” to enclose all tab pane divs. It doesn’t need an ID.
      • The tab panes are separate divs of class “tab-pane” nested inside the class “tab-content” div. Each tab pane has a separate ID, which must match the named anchors in the li declarations in Step 1.
      • The first tab tab pane has “active” in its class attribute. That selects the tab on page load.

4. Previous/Next Buttons: Unordered list of class “page wizard”

The First, Next, Previous, and Done buttons make clever use of the unordered list markup.

  • The ul must include the attribute class="pager wizard"

They do not need to be named First, Next, Previous, and Done because their function and position are both determined by a class attribute:

  • Each li tag contains an a link as the target.

As a bonus I’ve included access key attributes on the a links, which have nothing to do with the wizard. I just like keyboard shortcuts. Access keys let you use a letter key in conjunction with a system-defined key or key set to activate a control. For example, the Next button uses a href="#" accesskey="n". On a PC you’d press Alt+N key as the equivalent of the Next button, and on a Mac it would be Control+Option+N

5. Load the jquery.bootstrap.wizard.min.js in a script tag

The jquery.bootstrap.wizard.min.js file should be included as far down in the body as as possible, because sometimes Javascript files can page rendering.

6. Add Javascript code in a script tag

The magic in Vince’s progress bar code is in using jQuery to redraw the Bootstrap-provided progress bar div according to which tab is selected:

I added a few lines of optional code. For example, this section makes sure the Done button appears only when at the last tab, and that it’s active:

In Vince’s code, the Next button appears on the last tab, although it’s disabled. In my version, it’s removed on the last tab only:

Here’s what all the Javascript looks like.

Here’s a step by step recipe with all the code you need to see how to create a tabbed interface in Twitter Bootstrap in a single HTML file.

The result will look something like this:

Bootstrap.js tab tutorial

Try it out and grab the source for yourself here

Markup for the tabs

Bootstrap Tabs use an unordered list in conjunction with tab-content divs that contain a nested tab-pane for each div‘s content.

In this example the tab’s text is Sell. It could be any text but the most important attribute is the #sell attribute. It must match a div ID in the upcoming tab-pane div:

One of the tabs should appear as selected. Use the active attribute:

Here’s the full declaration for the tabs.

Next are the tab panes. The ID of each pane must match the href attribute but without the pound sign:

Here’s all the code in context. Save this as an HTML file and it will create the same kind of interface shown in the screen shot