Skip to content

Instantly share code, notes, and snippets.

@codeBelt
Last active June 3, 2019 01:47
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/a052930d5d94d3d4f7437af5ec96aa01 to your computer and use it in GitHub Desktop.
Save codeBelt/a052930d5d94d3d4f7437af5ec96aa01 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 {
firstName = '';
lastName = '';
age = 0;
address = LocationModel; // Creates a new LocationModel if there is address data
cars = [CarModel]; // Create an array of CarModel's or empty array if there is no data
constructor(data) {
super();
// Calls the update method on BaseModel
this.update(data);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment