According to angular.io , it says calling server on constructor is a bad idea and we should do it on other hookup methods of component lifecycle. Why is it so ? . is it about clean separation of responsibility ? Code:
ngOnInit():void{
this.heroes=this.heroService.getHeroes(); //better
}
constructor(private heroService:HeroService){
this.heroes=this.heroService.getHeroes(); //this is bad
}