Angular Component Inheritance

Base Component

// ...
import { Router } from '@angular/router';

constructor(public router: Router) { }

Take note of the accessibility level. It’s important to keep this declaration “public” due to the inheritance.

Inherited Components

export class PageoneComponent 
  extends BaseComponent
  implements OnInit {
    // ...
}
constructor(public router: Router) {
  super(router);
}

References
https://alligator.io/angular/component-inheritance/

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.