Example of input validation component for nativescript ng2, using class-validator
export abstract class BasicModel {
}
export class Login extends BasicModel {
@IsEmail(undefined, {message:"Email invalid"})
@IsNotEmpty({message:"Email is required"})
email: string;
@IsNotEmpty({message:"Password is required"})
password: string;
}
export class Book extends BasicModel {
@IsNotEmpty({message:"Name is required"})
name: string;
@IsNotEmpty({message:"Author is required"})
author: string;
@IsNotEmpty({message:"Pages is required"})
pages: string;
}