Day 3: Working with Models

In our third and final day of learning CanJS, we’ll discover more ways of working with observes and models. Remember that they are two of the focal points of a CanJS application. Drive the model and let views update themselves. Trigger events on observes and handle them in controls.

Let’s unravel how we can mold models to different requirements by creating filtered lists and by adding helper functions. We’ll start with some validation on the bookmark model.

Adding Validation

In our Sinatra web application, each bookmark must have a title and a URL. We also check the URL’s format. Server-side validation is nice—and essential—but client-side validation gives the user more immediate feedback and saves unnecessary client-server ...

Get Seven Web Frameworks in Seven Weeks now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.