I am implementing the following functions in Angular2's Component:
export class MypageEditComponent {
ngOnInit() {
this.timer = Observable.timer(100, 100);
this.timer.subscribe(t => {
this.setFormData();
}
private setFormData() {
this.editUserAcountType = this.authStore.registerInfo.account_type;
this.editAddress = this.authStore.registerInfo.email;
this.editUserName = this.authStore.registerInfo.username;
}
}
I want to stop the repeat of Observable.timer
once the value is correctly stored with setFormData()
.
But do not know how, please tell me.