我使用 angularjs 获得了一个用于 multi select2 下拉列表的 plunker 代码。它工作正常,除了在使用我的代码运行时选项值未绑定在选择选项中。
我已经链接了下面的 plunker 演示,但是 plunker 中的代码执行得很好,没有任何错误,但不知何故我在使用我的代码运行时遇到了这个错误......
控制台错误:
**"TypeError: transclude is not a function"**
插件链接:
http://plnkr.co/edit/juqoNOt1z1Gb349XabQ2?p=preview
这是包含这个演示模块和我的模块,如下所示,
var gateApp = angular.module('gateApp', ["demo","angucomplete"])
我正在与这个错误作斗争,任何人都可以给我建议。
供您参考在控制台中渲染的 HTML 代码:
<ul class="ui-select-choices ui-select-choices-content select2-results ng-scope" repeat="color in availableColors | filter:$select.search">
<li class="ui-select-choices-group" ng-class="{'select2-result-with-children': $select.choiceGrouped($group) }">
<div ng-show="$select.choiceGrouped($group)" class="ui-select-choices-group-label select2-result-label ng-binding ng-hide" ng-bind="$group.name">
</div>
<ul role="listbox" id="ui-select-choices-0" ng-class="{'select2-result-sub': $select.choiceGrouped($group), 'select2-result-single': !$select.choiceGrouped($group) }" class="select2-result-single"><!-- ngRepeat: color in $select.items -->
<!-- ngIf: $select.open -->
<li role="option" id="ui-select-choices-row-0-0" class="ui-select-choices-row ng-scope select2-highlighted" ng-class="{'select2-highlighted': $select.isActive(this), 'select2-disabled': $select.isDisabled(this)}" ng-repeat="color in $select.items" ng-if="$select.open" ng-click="$select.select(color,false,$event)"><div class="select2-result-label ui-select-choices-row-inner" uis-transclude-append="">
</div>
</li><!-- end ngIf: $select.open -->
<!-- end ngRepeat: color in $select.items -->
<!-- ngIf: $select.open -->
<li role="option" id="ui-select-choices-row-0-1" class="ui-select-choices-row ng-scope" ng-class="{'select2-highlighted': $select.isActive(this), 'select2-disabled': $select.isDisabled(this)}" ng-repeat="color in $select.items" ng-if="$select.open" ng-click="$select.select(color,false,$event)">
</li><!-- end ngIf: $select.open --><!-- end ngRepeat: color in $select.items --><!-- ngIf: $select.open -->
</ul>
</li>
</ul>