angular-ui の ui-select2 を使用しています。選択範囲にカスタム html フォーマットを追加したいと考えています。Select2 は、その構成で formatSelection を指定することでこれを可能にします。
選択範囲の書式設定に使用したい、以下のような角度タグを含む html があります。
var format_code = $compile('<div ng-click="showHide=!showHide" class="help-inline"><div style="cursor: pointer;" ng-show="!!showHide" ng-model="workflow.select" class="label">ANY</div><div style="cursor: pointer;" ng-hide="!!showHide" ng-model="workflow.select" class="label">ALL</div></div>')( $scope );
var format_html = "<span>" + data.n + ' : ' + data.v +' ng-bind-html-unsafe=format_code'+ "</span>"
$scope.select_config = {
formatSelection: format_html
}
上記のように html をコンパイルして割り当てると、[object,object] がブラウザーに表示されます。コンパイルしないと、html が適切にレンダリングされていることがわかりますが、Angular バインディングは発生しません。つまり、クリックは機能しません。
何が間違っているのですか?