【问题标题】:Angular4 (change) event not working with jQuery select2?Angular4(更改)事件不适用于 jQuery select2?
【发布时间】:2020-01-02 16:17:18
【问题描述】:

我在 Angular 4 项目中使用 jQuery select2,每当我尝试更改 select2 值时,尊重的函数都不会调用

HTML

<label> Parent SKU</label>

<select id="parent_sku" formControlName="parent_sku" class="form-control" [ngClass]="{ 'is-invalid': submitted && f.parent_sku.errors, 'disabled' : isDesginer }" (change)="selectParentSku()">
  <option *ngFor="let product of allProductsList | orderBy: 'modified_at': false " value="{{product.sku}}">{{product.sku}} : {{product.product_name}}
</option>
</select>

打字稿

selectParentSku() {
    console.log('hi');
}

【问题讨论】:

    标签: angular typescript jquery-select2


    【解决方案1】:

    使用 Angular ng-select2 的角度包装器,因此您不必担心 jquery。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-04-14
      • 2015-01-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-09-24
      • 2018-11-13
      相关资源
      最近更新 更多