From f4afb3712af3d684a5ecec1ea917d87f7941eb4e Mon Sep 17 00:00:00 2001
From: Scott Berg <saberg3@wisc.edu>
Date: Wed, 13 Mar 2019 10:17:29 -0500
Subject: [PATCH] ROENROLL-1457

---
 .../course-search/course-search.component.html              | 4 ++--
 .../degree-planner/course-search/course-search.component.ts | 6 +-----
 2 files changed, 3 insertions(+), 7 deletions(-)

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 fc06d6f..64eab64 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 ed42384..743abd9 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);
-- 
GitLab