Last active
April 5, 2020 17:35
-
-
Save ajayojha/b8f77d84837bb15dc48e78a51b1ca3c9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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