Skip to content

Instantly share code, notes, and snippets.

@ajayojha
Last active April 5, 2020 17:35
Show Gist options
  • Save ajayojha/b8f77d84837bb15dc48e78a51b1ca3c9 to your computer and use it in GitHub Desktop.
Save ajayojha/b8f77d84837bb15dc48e78a51b1ca3c9 to your computer and use it in GitHub Desktop.
import { alpha, required, minLength } from "@rxweb/reactive-forms";
export class User {
private _firstName: string = "";
private _lastName: string = "";
fullName!: string;
@required()
set firstName(value: string) {
this._firstName = value;
this.setFullName();
}
get firstName(): string {
return this._firstName;
}
@required()
set lastName(value: string) {
this._lastName = value;
this.setFullName();
}
get lastName(): string {
return this._lastName;
}
@alpha()
@minLength({value:4})
@required()
userName!: string;
setFullName() {
this.fullName = `${this.firstName} ${this.lastName}`
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment