Skip to content

Instantly share code, notes, and snippets.

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 sokhomhuy/d12fd8c86680e8f48c546a468210e1a6 to your computer and use it in GitHub Desktop.
Save sokhomhuy/d12fd8c86680e8f48c546a468210e1a6 to your computer and use it in GitHub Desktop.
export class ItemsComponent implements OnInit {
testing: Array<inventory>;
ngOnInit() {
this.testing = [
new inventory({
accountName: '',
accountCode: '',
items: [
new item({
itemCode: 'test',
itemName: 'testing',
}),
new item({
itemCode: 'test1',
itemName: 'testing1',
})
]
}),
new inventory({
accountName: '1123',
accountCode: '1414',
items: [
new item({
itemCode: 'fe',
itemName: 'testi23ng',
}),
new item({
itemCode: 'tes4t1',
itemName: 'testi42ng1',
})
]
})
];
}
}
export class inventory{
accountName: string;
accountCode: string;
items: Array<item>;
constructor(data?: inventory) {
if (data) {
for (var property in data) {
if (data.hasOwnProperty(property))
(<any>this)[property] = (<any>data)[property];
}
}
}
}
export class item {
itemName: string;
itemCode: string;
constructor(data?: item) {
if (data) {
for (var property in data) {
if (data.hasOwnProperty(property))
(<any>this)[property] = (<any>data)[property];
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment