I am facing a dilemma with 4 components, all of which have the same constructor. As a beginner, I am unsure how to approach this problem differently. Should I consider creating a service that encompasses what I refer to as common elements?
What would be your recommendation on how to handle this situation effectively?
The current constructor code used across all 4 components is as follows:
constructor(private transverseService: TransverseService, private webReferentielService: WebReferentielService) {
this.transverseService.setLanguage(new Messages(this.webReferentielService));
this.messages = this.transverseService.getMessages();
transverseService.messageObservable.subscribe(
msg => {
this.messages = msg;
}
);
this.transverseService.initConfig().then(data => {
this.configEnv = data;
this.version = this.configEnv.version;
this.env = this.configEnv.env;
});
}