Sunday, April 1, 2012

Trouble getting observableArray's running in Knockout?

I'm watching Knockout Fundamentals by Steve Michelotti

I was having trouble getting the example running that he wrote to show observableArray's.
There must be a bug in this URL

If you load the libraries in this order:

You will get all sorts of errors that will be very hard to track down.

Instead, use this URL from Microsoft and it works.

To get these working in jsFiddle, load jquery.tmpl.js first and knockout second. For jQuery you can choose the latest jquery framework from the frameworks dropdown.
The example working in jsfiddle

Here is the code outside of jsFiddle

Double click on these pictures to see the code enlarged.

1 comment:

Unknown said...

You are using an older version of KO. Using the 1.3beta version (today, 2.1 is the latest version) of the library (which was used in the Pluralsight course), you don't even need a reference to jQuery template library to do this. See here: