I would like to create extensions for some components already deployed in Angular 2, without having to rewrite them almost completely, as the base component could undergo ch
just use inheritance,Extend parent class in child class and declare constructor with parent class parameter and this parameter use in super().
1.parent class
@Component({
selector: 'teams-players-box',
templateUrl: '/maxweb/app/app/teams-players-box.component.html'
})
export class TeamsPlayersBoxComponent {
public _userProfile:UserProfile;
public _user_img:any;
public _box_class:string="about-team teams-blockbox";
public fullname:string;
public _index:any;
public _isView:string;
indexnumber:number;
constructor(
public _userProfilesSvc: UserProfiles,
public _router:Router,
){}
2.child class
@Component({
selector: '[teams-players-eligibility]',
templateUrl: '/maxweb/app/app/teams-players-eligibility.component.html'
})
export class TeamsPlayersEligibilityComponent extends TeamsPlayersBoxComponent{
constructor (public _userProfilesSvc: UserProfiles,
public _router:Router) {
super(_userProfilesSvc,_router);
}
}