我想将 ui-select 结果绑定到 ui-grid...
$scope.gridOptions = {
enableSorting: true,
showFooter: true,
columnDefs: [
{ field: 'name', name: 'Name' },
],
data: 'multipleDemo.selected',
onRegisterApi: function( gridApi ) {
$scope.gridApi = gridApi;
}
};
$scope.selectItem = function (item, model) {
$scope.gridApi.core.notifyDataChange( $scope.gridApi.grid, uiGridConstants.dataChange.EDIT );
};
我的翡翠模板是这样的:
ui-select(theme='bootstrap', multiple='', ng-model='multipleDemo.selected', ng-disabled='disabled', close-on-select='false', on-select='selectItem()')
ui-select-match(placeholder='select something...') {{$item.name}}
ui-select-choices(repeat='f in data | filter: $select.search')
div(ng-bind-html='f.name | highlight: $select.search')
#grid.grid(ui-grid="gridOptions")
编辑
我解决了这个问题。(我的 ng-controller 只在网格周围,而不是在选择周围......)