Skip to content

Instantly share code, notes, and snippets.

@HardikDG
Last active May 17, 2018 01:38
Show Gist options
  • Save HardikDG/b80c13ba73bb42ef93bc54b0d0ed821d to your computer and use it in GitHub Desktop.
Save HardikDG/b80c13ba73bb42ef93bc54b0d0ed821d to your computer and use it in GitHub Desktop.
Sample angular 5 model declaration
export class UserProfile {
id;
firstName;
lastName;
userName;
email;
gender;
phone;
birthDate;
image;
totpKey;
thumbs;
constructor({...userObj}) {
Object.assign(this, { ...userObj });
}
}
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