Knockout.js - Part 2

  • Jacob Swanner
  • 3344 views
Hall-pass

Oops, a subscription is required to view this video. You can enroll now to watch, or try out all that Code School has to offer with a free two-day Hall Pass.

Comments

Karl Coelho said

"and so, that's nice" ;)

really good screencast. had no clue about knockout.js. This helped a lot..

Petr Skocik said

@Robert Shaver: I've peeked a little bit into the official documentation, and they say that applyBindings takes an optional second argument which restricts it to only a particular section within your html like so: ko.applyBindings(myViewModel, document.getElementById('someElementId'))

I believe you could use this functionality to achieve you're goal of controlling multiple counters—just put them inside containers with different id's.

Ben Davies said

Thanks, nice screencast.

u+i interact said

Nice overview there, thank you very much. You could/should change the s to

Robert Shaver said

Nice intro to knockout. Thanks. Question: going back to the demo code from part 1, how would you add a separate independent counter?

For example, I'm extrapolating on your code to try to instantiate two counters and then bind them.

var counter_1 = new Counter(); var counter_2 = new counter(); ko.applyBindings(counter_1); ko.applyBindings(counter_2);

But I don't understand how to create a second set of markup and how the applyBindings will differentiate between the two counters. Surly I don't need a different version of Counter for each instance.

Thanks for a great learning experience.

borjaruby said

dam dont let me paste it :(

borjaruby said

I have problems w this code, loosk liek dont updates what ahve to update ...

Show the list of all posts in /posts.json titulo

  • Titulo,

Faculty

jacob said

@robbieclarken, glad you liked it. I hope you enjoy using Knockout.

Robbie Clarken said

Great screencasts - inspired me to give Knockout a go.

About

Knockout.js makes it easier to create rich, responsive UIs with JavaScript. In this series Jacob Swanner shows you the basics of using this client-side JavaScript library to keep your code organized.

Subscribe