Skip to Main Content
Hands-On Full Stack Web Development with Aurelia
book

Hands-On Full Stack Web Development with Aurelia

by Diego Argüelles Rojas, Erikson Murrugarra Murrugarra Sifuentes
June 2018
Intermediate to advanced content levelIntermediate to advanced
348 pages
8h 19m
English
Packt Publishing
Content preview from Hands-On Full Stack Web Development with Aurelia

First steps – Defining our rules

The Aurelia validation plugin is based on standard rules. We need to define our own set of rules using the ValidationRules class. This class has some static methods that receive our values and verify that the input value meet our requirements. Also, one validation rule must have one predefined format. The first method we will explain is ensure():

 ValidationRules.ensure('myValidatedProperty')

This method accepts one argument that will be our property name that we want to validate. Also, in case you were validating an object, you are allowed to pass anonymous functions as a parameter:

 ValidationRules.ensure(u => u.firstName)

The second method we will explain is displayName(). This is not required but is useful ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Front-End Tooling with Gulp, Bower, and Yeoman

Front-End Tooling with Gulp, Bower, and Yeoman

Stefan Baumgartner
Ember.js in Action

Ember.js in Action

Joachim Haagen Skeie

Publisher Resources

ISBN: 9781788833202Supplemental Content