acute-select icon indicating copy to clipboard operation
acute-select copied to clipboard

Updating model doesn't update items in drop dwon

Open markatbdex opened this issue 10 years ago • 3 comments

Doesn't seem like if I change the model, the drop down items get updated?

markatbdex avatar Oct 10 '14 17:10 markatbdex

Found a work around for this. Looks like the acRefresh was not finished. Temporarily, I added "refresh" variable based upon ac-refresh and set the $watch on refresh.

angular.module("acute.select", []) .directive("acSelect", function ($parse, acuteSelectService) { var defaultSettings = acuteSelectService.getSettings(); return { restrict: "EAC", scope: { "acSettings": "@", "acOptions": "@", "model": "=acModel", "acChange": "&", "keyField": "@acKey", "acRefresh": "=", "refresh": "=acRefresh" },

        $scope.$watch("refresh", function (newValue, oldValue) {
            if (newValue != oldValue) {
                $scope.initialise();
            }
        });

markatbdex avatar Oct 11 '14 01:10 markatbdex

This solves the problem with the update, but we don't need to use

 if (newValue != oldValue)

Because $watch is only called when the newValue !== oldValue

sibelius avatar Jun 12 '15 19:06 sibelius

Awesome! thank you @sibeliusseraphini

scotteza avatar Jun 19 '15 21:06 scotteza