Hello. In the exercise at 16- Exercise | Code with Mosh and solution at 17- Solution | Code with Mosh the solution given only shows creating a class outside of angular and testing with typescript and node. When I follow this solution in an angular app I get compiler error: src/app/app.module.ts:15:5 - error NG6001: The class ‘LikeComponent’ is listed in the declarations of the NgModule ‘AppModule’, but is not a directive, a component, or a pipe. Either remove it from the NgModule’s declarations, or add an appropriate Angular decorator. I created this component with the Angular CLI, and all appropriate decorators and mentions in app.module.ts are in place. The problem is the constructor of the class.
It seems I cannot use the constructor as shown in an actual Angular app. Can you please tell me why this doesn’t work in an Angular app, and what would be needed to make it work? The only way I can get the compiler error to go away is to leave the constructor empty or remove it entirely.