Last active
May 17, 2018 01:38
-
-
Save HardikDG/b80c13ba73bb42ef93bc54b0d0ed821d to your computer and use it in GitHub Desktop.
Sample angular 5 model declaration
This file contains hidden or 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
export class UserProfile { | |
id; | |
firstName; | |
lastName; | |
userName; | |
email; | |
gender; | |
phone; | |
birthDate; | |
image; | |
totpKey; | |
thumbs; | |
constructor({...userObj}) { | |
Object.assign(this, { ...userObj }); | |
} | |
} |
This file contains hidden or 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
export class UserProfile { | |
id; | |
firstName; | |
lastName; | |
userName; | |
email; | |
gender; | |
phone; | |
birthDate; | |
constructor({...userObj}) { | |
this.id = userObj.id ; | |
this.firstName = userObj.firstName || ''; | |
this.lastName = userObj.lastName || ''; | |
this.userName = userObj.userName; | |
this.email = userObj.email; | |
this.gender = userObj.gender; | |
this.phone = userObj.phone; | |
this.birthDate = userObj.birthdate; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment