February 2015
Intermediate to advanced
232 pages
4h 40m
English
To validate our models using the Knockout Validation library, we are going to extend our model's attributes. Extenders are a basic feature of Knockout. Using extenders we can add some properties to our observables to increase their behavior. For more information on extenders, please refer to the following link:
http://knockoutjs.com/documentation/extenders.html
We are going to extend our product model with some properties that will allow us to validate data by following these steps:
models/Product.js file.name field. It should have at least three letters and should contain just letters, numbers, and dashes:_name = ko.observable(name).extend({ required: true, minLength: 3, pattern: { message: 'Hey ...Read now
Unlock full access