【发布时间】:2017-09-28 03:38:53
【问题描述】:
拥有
userGroups: IUserGroup[];
this.service.getUserGroups().subscribe(g => this.userGroups = g);
getUserGroups 返回IUserDifferentGroup[] 但IUserGroup 和IUserDifferentGroup 具有相同的字段另外IUserGroup 有更多,如何将响应映射到新类型?
interface IUserDifferentGroup{
Name: string;
Code: string;
Id: number;
}
interface IUserGroup {
Id: number;
GroupName: string;
Visible: boolean;
IsDefault: boolean;
CanAssociated: boolean;
}
【问题讨论】:
标签: angular typescript