내가 이런 모델이 있습니다각도 4 모델 속성
export class DepositReceipt{
euro1: number;
euro2: number;
euro5: number;
euro10: number;
euro20: number;
euro50: number;
euro100: number;
euro200: number;
euro500: number;
totalAmount: number;
}
속성 totalAmount 실제로 다른 속성의 합입니다, 그것은 같은 모델 뭔가를 정의 할 수 있습니다 : totalAmount = euro500 + euro200 +...
아니면 가능하지 않으면 어떻게 작동시킬 수 있습니까?
서버에서 응답을 받으면 다른 사람들의 합계이기 때문에이 필드가 자동으로 계산됩니다.
'얻을 totalAmount() {euro1 + euro2 + ...를 반환; }'? 아마도 TS 문서 (https://www.typescriptlang.org/docs/handbook/classes.html – jonrsharpe