Please explain in this code, how to call ngOnInit()
again when I call another method?
ngOnInit(): void {
this.route.params.subscribe((params: Params) => {
this.model = this.userData;
});
}
update() {
this.loading = true;
this.userService.update(this.model).subscribe(
(data) => {
alert('Update successful');
},
(error) => {
alert('Not updated');
this.loading = false;
},
);
this.user_data();
}
ngOnInit()
.ngOnInit()
is called once for every method. There is no way to make it being called multiple times. – Blida