当我运行 ng build -prod 时,我收到以下警告。
Warning: Can't resolve all parameters for UsersPermissionsService in C:/SourceControl/Test.Client/src/app/shared/users/users-permissions.service.ts: (?, ?, ?). This will become an error in Angular v5.x
Warning: Can't resolve all parameters for UsersPermissionsService in C:/SourceControl/Test.Client/src/app/shared/users/users-permissions.service.ts: (?, ?, ?). This will become an error in Angular v5.x
我的代码如下:
import { Injectable } from '@angular/core';
@Injectable()
export class UsersPermissionsService {
public USERS_CREATE_PERMISSION: string = '';
public USERS_UPDATE_PERMISSION: string = '';
public USERS_DELETE_PERMISSION: string = '';
constructor(public UsersCreatePermission: string,
public UsersUpdatePermission: string,
public UsersDeletePermission: string) {
this.USERS_CREATE_PERMISSION = UsersCreatePermission;
this.USERS_UPDATE_PERMISSION = UsersUpdatePermission;
this.USERS_DELETE_PERMISSION = UsersDeletePermission;
}
}
@Injectable()
export class UserModulePermissionsService extends UserPermissionsService {
constructor() {
super("ClientsCreate",
"ClientsEdit",
"ClientsDelete");
}
}
@Component({
templateUrl: './users-permissions.component.html',
providers: [UsersPermissionsService]
})
export class UsersPermissionsComponent {
constructor(public usersPermissionsService: UsersPermissionsService) {
}
}
在我的延迟加载模块中,我有:
providers: [
{ provide: UsersPermissionsService, useClass: UserModulePermissionsService }
]
现在 angular 5 出来了,我需要更新,正如消息所说,这个警告将变成一个错误。
不明白这里真正的问题是什么。