set default value in dropdown search
<p>In angular 2 I try to use select2 and semantic-ui dropdown to use dropdown search. It's ok when it doesn't have default value. but when I set default value in page edit data, the data won't show default value. It will show value only if I use "setTimeout()". Anyway I can show default value without setTimeout ?</p>

<p>html (select2 version)</p>

<pre><code>&lt;select class="form-control select2" id="input-contactperson" (change)="setContactPerson($event.target.value)"&gt;
   &lt;option value="" disabled&gt;please select&lt;/option&gt;
   &lt;option *ngFor="let contactperson of objContactPerson" [selected]="contactperson.contactPersonId == contactPerson" value="{{contactperson.contactPersonId}}"&gt;{{contactperson.contactPersonName}}&lt;/option&gt;
&lt;/select&gt;
</code></pre>

<p>html (semantic version)</p>

<pre><code>&lt;select class="form-control ui fluid search dropdown" id="input-contactperson" (change)="setContactPerson($event.target.value)"&gt;
   &lt;option value="" data-value=""&gt;please select&lt;/option&gt;
   &lt;option *ngFor="let contactperson of objContactPerson" [selected]="contactperson.contactPersonId == contactPerson" value="{{contactperson.contactPersonId}}"&gt;{{contactperson.contactPersonName}}&lt;/option&gt;
&lt;/select&gt;
</code></pre>

<p>In the html above I use [selected] to match value while contactPerson equal  contactperson.contactPersonId It won't show if I don't use setTimeout()</p>

<p>component</p>

<pre><code>setTimeout(function () {
    // $("#input-contactperson").select2("val", contactpersonid); //select 2
    $(".ui.dropdown").dropdown("set selected", contactpersonid); // semantic
}, 500);
</code></pre>