Skip to content

Instantly share code, notes, and snippets.

@SevdaCimen
Last active May 28, 2020 13:57
Show Gist options
  • Save SevdaCimen/0465523d7e703aedba747998adb7a212 to your computer and use it in GitHub Desktop.
Save SevdaCimen/0465523d7e703aedba747998adb7a212 to your computer and use it in GitHub Desktop.
onChange(): void {
this.form.get('studentNumber').valueChanges.subscribe(number => {
//assumed that student number must be 5 digits
if (number.length === 5) {
this._service.studentInfo(number).subscribe(response => {
this.data = response;
});
}
}
else {
this.data = {} as StudentModel;
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment