I create test.model.ts:
我创建test.model.ts:
export interface IPosting {
text: string;
docDate: string;
isDebit: boolean;
amount: number;
debitAmount: string;
creditAmount: string;
}
export class Posting implements IPosting {
text: string;
docDate: string;
isDebit: boolean;
amount: number;
debitAmount: string;
creditAmount: string;
constructor(text: string, docDate: string, isDebit: boolean, amount: number) {
this.text = text;
this.docDate = docDate;
this.isDebit = isDebit;
this.amount = amount;
this.debitAmount = (isDebit) ? this.amount.toString() : '';
this.creditAmount = (isDebit) ? '' : this.amount.toString();
}
}
e