在 Angular 8 中,我能够使用“@Injectable”属性创建基本组件(继承实际组件的类)。 Angular 9 编译器告诉我:
组件 YourComponent 从 BaseComponent 继承其构造函数,但后者没有自己的 Angular 装饰器。依赖注入将无法解析 BaseComponent 构造函数的参数。向 BaseComponent 添加 @Directive 装饰器,或向 RoleSelectDialogComponent 添加显式构造函数。
Angular 9 现在做这些事情的方式是什么?这可行,但看起来有些古怪:
@Component({
selector: 'baseComponent',
template: 'no-ui'
})
线索就在消息里
Either add a @Directive decorator to BaseComponent
向其中添加 @Directive() 应该可以解决问题。
我现在刚刚进行升级,我的基本组件自动添加了 @Directive() 装饰器。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)