Member-only story
Angular: Inheritance Without Effort
A great way of using inheritance in our app without maintenance

Written in TypeScript, Angular makes it possible to use the concept of inheritance in our components.
However, we face a problem when we want services in child components.
Getting Started
Let’s start by creating our BaseComponent
:
See that the decorator Component
is not necessary — we don’t have to declare this class in the module, as it is not a component. We can also declare it as an abstract class as we would do in regular OOP language.
Then, we create our two components extended by the BaseComponent
:
When we navigate from one component to another, the logs are correctly printed in the…