【发布时间】:2018-11-13 17:13:25
【问题描述】:
(change) 指令在 angular 5 中与普通 select html 标记一起工作正常。但是如果我实现 select2 插件,那么 (change) 将不起作用。
这是我的 html 文件
<select class="select2Select" [(ngModel)]="productSearchItem" (ngModelChange)="test()">
<option value="">Search entire store here...</option>
<option *ngFor="let product of products" value="{{ product.pid }}">{{ product.name }}</option>
</select>
这个函数什么都不做,只是在打字稿中安慰一些东西
test(){
console.log("Hi");
}
脚本:
$(document).ready(function() {
$('.select2Select').select2();
});
【问题讨论】: