在为 Angular 应用程序提供服务时,在 Angular v10 中出现控制台错误
core.js:4197 ERROR TypeError: Cannot call a class as a function at _classCallCheck (classCallCheck.js:3) at new Button (button.js:36) at ButtonComponent.<anonymous> (createSuper.js:12) at new ButtonComponent (button.component.ts:30) at NodeInjectorFactory.ButtonComponent_Factory [as factory] (button.component.ts:57) at getNodeInjectable (core.js:4029) at instantiateAllDirectives (core.js:8092) at createDirectivesInstances (core.js:7474) at ɵɵelementStart (core.js:14001) at SBController_Template (template.html:114)
演示:https ://github.com/kumaresan-subramani/AngularSampleIssue
重现步骤:
- npm 我
- npm 运行开始
角度团队的回答- https://github.com/angular/angular-cli/issues/18125#issuecomment-672069800