As I work on Angular2's Component, I am currently implementing the following functions:
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 am trying to figure out how to stop the repetition of Observable.timer
once the data is correctly stored using setFormData()
.
If you have any ideas on how to achieve this, please let me know.