Detect Input Focus Using Angular 2+
<p>I'm trying to create an auto-complete list that appears as you type, but disappears when you click elsewhere on the document. How do I detect that a form input is focused using Angular 2. Angular 1 has ng-focus, but I don't think Angular 2 supports that anymore.</p>

<pre><code>&lt;input id="search-box" type="search" class="form-control [(ngModel)]=query (keyup)=filter()&gt;
    &lt;div id="search-autocomplete" *ngIf="filteredList.length &gt; 0"&gt;
        &lt;ul *ngFor="#item of filteredList" &gt;
            &lt;li &gt; &lt;a (click)="select(item)"&gt;{{item}}&lt;/a&gt; &lt;/li&gt;
        &lt;/ul&gt;
    &lt;/div&gt;
</code></pre>

<p>By the way, I used this tutorial as <a href="http://4dev.tech/2016/03/tutorial-creating-an-angular2-autocomplete/" rel="noreferrer">guidance</a>.</p>