title: ERROR TypeError: Cannot read property 'length' of undefined
body: <p>There is an error in this part of my code</p>
  
  <pre><code>&lt;img src="../../../assets/gms-logo.png" alt="logo" routerLink="/overview" alt="website icon"&gt;
  </code></pre>
  
  <p>But when I checked the assets folder, <code>gms-logo.png</code> is still there and in <code>angular-cli.json</code>, assets is also there. The path is also correct. </p>
  
  <p>Recently though, I've been working on Search function. So my hypothesis is, </p>
  
  <blockquote>
    <p>Has the program started searching even if the user is still not focused on the input type? How do I fix this?</p>
  </blockquote>
  
  <p>Below is my html for Search and the showing of its suggestion segment</p>
  
  <pre><code>&lt;input type="text" placeholder="Search" (keyup)="onSearch($event.target.value)"&gt;        
  &lt;div class="suggestion"  *ngIf="results.length &gt; 0"&gt;
       &lt;div *ngFor="let result of results "&gt;
            &lt;a href="" target="_blank"&gt;
                  {{ result.name }}
            &lt;/a&gt;
       &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Below is my component</p>
  
  <pre><code>results: Object;
  
  
  
   onSearch(name) {
              this.search
              .searchEmployee(name)
              .subscribe(
                  name =&gt; this.results = name,//alert(searchName),this.route.navigate(['/information/employees/']),
                  error =&gt; alert(error),
                  );
  }
  </code></pre>