title: Angular2: Set change attribute for select in Typescript
body: <p>I am dynamically creating dropdowns in my typescript code. That works perfectly fine. However, I cannot figure out how to set the "onchange" event for the dropdowns - so that it triggers whenever the value of the dropdown is changed.</p>
  
  <p>That's my ts code so far:</p>
  
  <pre><code>  private createDropDown() {
      const parent = document.getElementById('dropdown-container');
      const sel: any = document.createElement('select');
      sel.setAttribute('id', 'bbCount' + this.bbCount);
      sel.setAttribute('class', 'labelDropdown');
      $('labelDropdown').on('change', e =&gt; this.onDropdownChange(e));
      for (let i = 0; i &lt; 8; i++) {
        const opt: any = document.createElement('option');
        opt.setAttribute('text', this.labels[i].value);
        opt.setAttribute('value', String(this.labels[i].id));
        opt.innerText = this.labels[i].value;
        sel.appendChild(opt);
      }
      parent.appendChild(sel);
    }
  
    public onDropdownChange(e) {
      console.log('event', e);
    }
  </code></pre>
  
  <p>html:</p>
  
  <pre><code>  &lt;div style="width: 100%" id="dropdown-container"&gt;
    &lt;/div&gt;
  </code></pre>
  
  <p>I tried several approaches, the last one was        </p>
  
  <blockquote>
    <p>$('labelDropdown').on('change', e => this.onDropdownChange(e));</p>
  </blockquote>
  
  <p>However, this.onDropdownChange(e) is never called or just when the dropdown is created and not when the value is changed.</p>
  
  <p>Does anyone know how I can set the change event on the select inside my typescript code?</p>