我是 AngularJs 世界的新手,并试图在组件内部使用 angularjs-dropdown-multiselect。
组件的 HTML 如下所示:
<div>
<select id="statusSelection" class="form-control"
ng-options="status.name for status in $ctrl.statuses track by status.id"
ng-model="$ctrl.status" ng-change="$ctrl.filterChanged()"></select>
</div>
<div ng-dropdown-multiselect="" options="$ctrl.categories" selected-model="$ctrl.category"
events="$ctrl.events">
</div>
状态更改和类别的事件将调用相同的操作。
MultiselectController.prototype.filterChanged = function() {
this.onFilterChange({
status: this.status,
category: this.category});
};
MultiselectController.prototype.events = {
onItemSelect: function(item) {
filterChanged();
},
onItemDeselect: function(item) {
filterChanged();
}
};
当我尝试运行上述代码并更改状态时,代码按预期工作,但在类别更改期间失败(控制台错误)。
错误消息:ReferenceError: filterChanged 未定义
角度版本:1.5.8
angularjs-下拉多选:1.11.8
Plunker:http ://plnkr.co/edit/JL7N6M?p=preview
谢谢你在这里帮我。