请在这段代码中解释一下,ngOnInit()
当我调用另一个方法时如何再次调用?
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();
}