How to set ui-select to readonly mode?

Alexander Vasilyev picture Alexander Vasilyev · Aug 12, 2015 · Viewed 14.2k times · Source

Is it possible and how to make my ui-select readonly? Of course I've tried ng-readonly="isReadOnly" where I define in my controller $scope.isReadOnly=false; And of course I want to calculate it "in runtime" according to data from server that can change the state.

Answer

Alexander Vasilyev picture Alexander Vasilyev · Aug 12, 2015

Use ng-disabled instead of ng-readonly.

<ui-select ng-disabled="isReadOnly" ...>
    ...
</ui-select>