These are chat archives for angular-ui/ui-select

1st
Jun 2015
Justin Romaine
@justin-romano
Jun 01 2015 20:57
Hi All. Im using uiSelect with uiGrid but am having trouble with scope for the uiSelectChoices "refresh" callback function.
Anyone know which scope i need to place my callback. I have tried colDef of the uigrid and the main controller scope but nothing gets called. Anyone here been down this path?
im basing my code on Brian's example http://brianhann.com/ui-grid-and-dropdowns/
So i have been trying to grab the scope using the wrapper directive in the example but the uiSelect refresh method seems to ignore it.
 app.directive("uiSelectWrap", ["$document", "uiGridEditConstants",
    function ($document, uiGridEditConstants) {
        return {
            scope: {
                refreshSearch: "&"
            },
            link: function ($scope, $elm, $attr) {

                var $select = angular.element($elm, ".ui-select-choices").scope();
                $select.refreshSearch = $scope.refreshSearch;
                $document.on('click', function docClick(evt) {
                    if ($(evt.target).closest('.ui-select-container').size() === 0) {
                        $scope.$emit(uiGridEditConstants.events.END_CELL_EDIT);
                        $document.off('click', docClick);
                    }
                });
            }
        }
    }]);
Justin Romaine
@justin-romano
Jun 01 2015 21:03
So im grabbing the select scope from angular.element and assigning a method from the main controller to get the data for the choices