Since Angular 2.3, we can use Components inheritance. The feature improve code reusability and desgin of our applications. This feature covers all of the following :
- Metadata : You can herit of parent properties or override them. So, we can inherit from @NgModule, @Host, @Self @SkipSelf, @Inject, @Optionnal, @Attribute, @ContentChild, @ContetnChildren, @ViewChild … and lot of them.
- Constructor : As with the ES6, you can use the super() constructor
- LifeCycle : You can also herit of parent lifeCycle.
But, there is no inheritance betwen templates. You should manage it separately.
Lets see an example of use :
And the plnkr :
For this moment, we can instantiate an abstract component. I have opened an issue on github. Wait and see ….