我正在研究Angular5应用程序。我有模型类RoleClaimEntryDataModel,在一个可注入服务中,我有方法“updaterRoleClaimByID”接收RoleClaimEntryDataModel作为参数,我正试图将此对象分配给类的RoleClaimEntryDataModel,但我得到了错误
错误
Type 'RoleClainEntryDataModel' is not assignable to type 'typeof RoleClaimEntryDataModel'/
Property 'prototype' is missing in type 'RoleClaimEntryDataModel'
模型类
export class RoleClaimEntryDataModel{
roleId:string;
claimId:string;
isClaimAssignToRole:boolean;
}
注射服务A
@Injectable()
export class UpdateRoleClaimCommand extends BaseCommand<boolean> {
public data = RoleClaimEntryDataModel;
initialise(): void {
super.setBody(this.data);
}
}
注射服务B
@Injectable()
export class PermissionDataService{
constructor(
private updateRoleClaimCommand: UpdateRoleClaimCommand
){}
public UpdateRoleClaimById(roleClaimEntryDataModel: RoleClaimEntryDataModel)
{
this.updateRoleClaimCommand.data = roleClaimEntryDataModel; // throw error here
}