在 Angular 8 中,我能够使用“@Injectable”属性创建基础组件(实际组件继承自的类)。Angular 9 编译器告诉我:
组件 YourComponent 从 BaseComponent 继承其构造函数,但后者没有自己的 Angular 装饰器。依赖注入将无法解析 BaseComponent 的构造函数的参数。向 BaseComponent 添加一个 @Directive 装饰器,或者向 RoleSelectDialogComponent 添加一个显式构造函数。
现在 Angular 9 做这些事情的方式是什么?这可行,但看起来有点hacky:
@Component({
selector: 'baseComponent',
template: 'no-ui'
})