diff --git a/src/app/degree-planner/course-search/course-search.component.html b/src/app/degree-planner/course-search/course-search.component.html index fc06d6f1bc800a21630f5feae4377c7212843b72..64eab6413bab26793e15bec1df11077dfa59b6a1 100644 --- a/src/app/degree-planner/course-search/course-search.component.html +++ b/src/app/degree-planner/course-search/course-search.component.html @@ -9,8 +9,8 @@ <mat-form-field class="example-full-width"> <input type="text" placeholder="Subject" aria-label="Subject" matInput #subjectInput formControlName="subject" [matAutocomplete]="subject"> - <mat-autocomplete autoActiveFirstOption #subject="matAutocomplete"> - <mat-option *ngFor="let subject of filteredSubjects" [value]="subject | titlecase" (onSelectionChange)="subjectChange($event, subjectInput)">{{subject | titlecase}}</mat-option> + <mat-autocomplete autoActiveFirstOption #subject="matAutocomplete" (optionSelected)="subjectChange($event, subjectInput)"> + <mat-option *ngFor="let subject of filteredSubjects" [value]="subject | titlecase">{{subject | titlecase}}</mat-option> </mat-autocomplete> </mat-form-field> diff --git a/src/app/degree-planner/course-search/course-search.component.ts b/src/app/degree-planner/course-search/course-search.component.ts index ed42384a9b844d186f2a09c3a584f770c689bfe9..743abd9ed63223c4f092b6be58e15c89cd97a951 100644 --- a/src/app/degree-planner/course-search/course-search.component.ts +++ b/src/app/degree-planner/course-search/course-search.component.ts @@ -160,10 +160,7 @@ export class CourseSearchComponent implements OnInit, OnDestroy { } public subjectChange($event, input) { - console.log(input); - - const subject = $event.source.value; - const { search, term } = this.courseSearchForm.value; + const { search, term, subject } = this.courseSearchForm.value; this.search(search, term, subject); // Focus is needed to keep the cursor at the start of the input after a selection is made @@ -189,7 +186,6 @@ export class CourseSearchComponent implements OnInit, OnDestroy { // Run a search and display all results if the serach is valid public search(search, term, subject) { // Get the form field values - console.log(subject); // Check if subject is valid const subjectCode = this.getSubjectCode(subject);