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

feat(autocomplete): support readonly attribute #7107

Closed

Conversation

devversion
Copy link
Member

@robertmesserle Please review :)

Fixes #5507

@@ -166,6 +167,7 @@ function MdAutocompleteCtrl ($scope, $element, $mdUtil, $mdConstant, $mdTheming,
var wait = parseInt($scope.delay, 10) || 0;
$attrs.$observe('disabled', function (value) { ctrl.isDisabled = !!value; });
$attrs.$observe('required', function (value) { ctrl.isRequired = !!value; });
$attrs.$observe('readonly', function (value) { ctrl.isReadonly = !!value; });
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This attribute needs to be fixed too (hopefully using the util method of #6803). Currently an empty readonly won't work...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we use ctrl.isReadonly = value !== null for now? I think that should work.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@robertmesserle Done - re-enabled test. I will rebase #6803 if this PR is merged.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea, once #6803 gets merged, these will all use your utility function, right?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, then the attributes will also work with an empty attribute value. And a little side-effect will be, that required="false" also works. This won't break any existing versions, because it just adds false and 0 as a negative value.

@devversion devversion force-pushed the feat/autocomplete-readonly branch 2 times, most recently from b5f1357 to 7d11647 Compare February 10, 2016 17:30
@ThomasBurleson
Copy link
Contributor

@devversion - please rebase with master. I think another PR (readonly validations) conflicts with this one.

@ThomasBurleson ThomasBurleson added needs: rebase This PR needs to be rebased on the latest commits from master and conflicts need to be resolved needs: work labels Feb 26, 2016
@devversion devversion added pr: merge ready This PR is ready for a caretaker to review and removed needs: rebase This PR needs to be rebased on the latest commits from master and conflicts need to be resolved needs: work labels Feb 26, 2016
ThomasBurleson pushed a commit that referenced this pull request Apr 1, 2016
gmoothart pushed a commit to gmoothart/material that referenced this pull request Apr 5, 2016
@devversion devversion deleted the feat/autocomplete-readonly branch April 19, 2016 19:48
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
pr: merge ready This PR is ready for a caretaker to review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants