有人可以告诉我如何在Angular 4中声明用户模型



它是我的用户模型,正确吗?我可以添加方法????

export class User {
  id: number;
  login: string;
  hash: string;
  salt: string;
  fname: string;
  lname: string;
  sname: string;
  phone: string;
  addTime: string;
  isActive: boolean;
}

这是我复制的原型

export class Model{ //something like this for getter and setters and also other methods 
    private _keyValue: number;
    private _computedValue: number;
    getKeyValue(): number{
        return this._keyValue;
    }
    setKeyValue(value: number){
        this._keyValue = value;
    }
    getComputedValue(): number{
        return this._computedValue;
    }
    customeMethod(){}
}

最新更新