While serving the Angular application, getting below console error in 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)
Demo: https://github.com/kumaresan-subramani/AngularSampleIssue
Steps to Reproduce:
Answer from angular Team - https://github.com/angular/angular-cli/issues/18125#issuecomment-672069800
I did have a look on your repo. It looks like your ES target
has been set as es5
in your tsconfig.base.json
file which doesn't support class. I think you have to set it at least from es6
(es2015
), then it's supposed to be working:
{
"compilerOptions": {
"target": "es2015",
}
}