Skip to content
This repository was archived by the owner on Sep 5, 2024. It is now read-only.

Commit e0a7843

Browse files
devversionThomasBurleson
authored andcommitted
feat(autocomplete): support readonly attribute
Fixes #5507 Closes #7107
1 parent 9a2385e commit e0a7843

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

src/components/autocomplete/js/autocompleteController.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ function MdAutocompleteCtrl ($scope, $element, $mdUtil, $mdConstant, $mdTheming,
3636
ctrl.id = $mdUtil.nextUid();
3737
ctrl.isDisabled = null;
3838
ctrl.isRequired = null;
39+
ctrl.isReadonly = null;
3940
ctrl.hasNotFound = false;
4041

4142
//-- public methods
@@ -166,6 +167,7 @@ function MdAutocompleteCtrl ($scope, $element, $mdUtil, $mdConstant, $mdTheming,
166167
var wait = parseInt($scope.delay, 10) || 0;
167168
$attrs.$observe('disabled', function (value) { ctrl.isDisabled = $mdUtil.parseAttributeBoolean(value, false); });
168169
$attrs.$observe('required', function (value) { ctrl.isRequired = $mdUtil.parseAttributeBoolean(value, false); });
170+
$attrs.$observe('readonly', function (value) { ctrl.isReadonly = $mdUtil.parseAttributeBoolean(value, false); });
169171
$scope.$watch('searchText', wait ? $mdUtil.debounce(handleSearchText, wait) : handleSearchText);
170172
$scope.$watch('selectedItem', selectedItemChange);
171173
angular.element($window).on('resize', positionDropdown);

src/components/autocomplete/js/autocompleteDirective.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,7 @@ function MdAutocomplete () {
230230
name="{{inputName}}"\
231231
autocomplete="off"\
232232
ng-required="$mdAutocompleteCtrl.isRequired"\
233+
ng-readonly="$mdAutocompleteCtrl.isReadonly"\
233234
ng-minlength="inputMinlength"\
234235
ng-maxlength="inputMaxlength"\
235236
ng-disabled="$mdAutocompleteCtrl.isDisabled"\
@@ -255,6 +256,7 @@ function MdAutocomplete () {
255256
autocomplete="off"\
256257
ng-required="$mdAutocompleteCtrl.isRequired"\
257258
ng-disabled="$mdAutocompleteCtrl.isDisabled"\
259+
ng-readonly="$mdAutocompleteCtrl.isReadonly"\
258260
ng-model="$mdAutocompleteCtrl.scope.searchText"\
259261
ng-keydown="$mdAutocompleteCtrl.keydown($event)"\
260262
ng-blur="$mdAutocompleteCtrl.blur()"\

0 commit comments

Comments
 (0)