Skip to content

Instantly share code, notes, and snippets.

@codeBelt
Last active June 3, 2019 01:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codeBelt/b173c573ef1a8b1581ae56c4719e2657 to your computer and use it in GitHub Desktop.
Save codeBelt/b173c573ef1a8b1581ae56c4719e2657 to your computer and use it in GitHub Desktop.
import LocationModel from './LocationModel';
import CarModel from './CarModel';
import {BaseModel} from 'sjs-base-model';
class PersonModel extends BaseModel {
public readonly firstName: string = '';
public readonly lastName: string = '';
public readonly age: string = 0;
public readonly address: LocationModel = LocationModel as any;
public readonly cars: CarModel[] = [CarModel as any];
/*
* Client-Side properties (Not from API)
*/
public fullName: string = '';
constructor(data: Partial<PersonModel>) {
super();
this.update(data);
}
public update(data: Partial<PersonModel>): void {
super.update(data);
this.fullName = `${this.firstName} ${this.lastName}`;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment