On an Angular 12 componente I have the following:
export class SignUpComponent implements OnInit {
environment: Environment;
form: FormGroup;
stage: number;
constructor(
private router: Router,
private title: Title,
private formBuilder: FormBuilder,
private analyticsService: AnalyticsService,
private environmentService: EnvironmentService) {
this.environment = this.environmentService.get();
this.title.setTitle('Registar - Bons Alunos');
this.analyticsService.pageview('Sign Up', this.router.url);
this.form = this.formBuilder.group({
email: ['', [Validators.required, Validators.email]]
});
this.stage = 1;
}
ngOnInit() { }
Question
What should I move from the component's constructor to the ngOnInit
method?
What kind of code should I place on ngOnInit
that cannot / should not be on the constructor?