Skip to content
This repository has been archived by the owner on Aug 29, 2023. It is now read-only.

mdAutocomplete - Problem when md-selected-item become null #8788

Closed
fif1973 opened this issue Jun 17, 2016 · 2 comments
Closed

mdAutocomplete - Problem when md-selected-item become null #8788

fif1973 opened this issue Jun 17, 2016 · 2 comments
Assignees
Labels
has: Pull Request A PR has been created to address this issue needs: investigation The cause of this issue is not well understood and needs to be investigated by the team or community

Comments

@fif1973
Copy link

fif1973 commented Jun 17, 2016

Actual behavior:

  • What is the issue? *
    When md-selected-item change to null or undefined value the field stay with previous value
  • What is the expected behavior?
    the field should be cleared

CodePen or Steps to reproduce the issue: *

  • CodePen Demo which shows your issue :

http://codepen.io/fif1973/pen/oLzvbj?editors=1010

  • Details:

click on right list on 1st item, the form is updated with correct values

click on right list on 2nd item, the form is updated with correct values

click on right list on 3rd item, the form is updated but the field 'company' should be clear and it stay with previous value

Angular Versions: *

  • Angular Version: same issue with AJS 1.4.8 and 1.5.3
  • Angular Material Version: same issue with AM 1.0.9 and 1.1.0-rc2

Additional Information:

  • Browser Type: Chrome
  • Browser Version: Version 51.0.2704.84 (64-bit)
  • OS: OSX
  • Stack Traces:

Shortcut to create a new CodePen Demo.
Note: * indicates required information. Without this information, your issue may be auto-closed.

Do not modify the titles or questions. Simply add your responses to the ends of the questions.
Add more lines if needed.

@crisbeto crisbeto self-assigned this Jun 20, 2016
@crisbeto crisbeto added this to the - Backlog milestone Jun 20, 2016
@crisbeto crisbeto assigned devversion and unassigned crisbeto Jun 26, 2016
@devversion
Copy link
Member

The problem is that, md-selected-item is not synchronized with the searchText.

The selectedItem will be properly cleared, but the searchText wont be affected of that.


We probably have to consider clearing the searchText, when the selectedItem will be cleared.

@devversion devversion added the needs: investigation The cause of this issue is not well understood and needs to be investigated by the team or community label Jul 6, 2016
@fif1973
Copy link
Author

fif1973 commented Jul 7, 2016

Effectively when i set searchText to null when a person is selected (into my codepen example), it works like expected.

$scope.setSelectedPerson = function(person) {
$scope.searchText=null;
$scope.selectedPerson = person;
};

but it will be more intuitive if it can be done automatically

devversion added a commit to devversion/material that referenced this issue Jul 18, 2016
* Currently the autocomplete always updates the searchText according the changed selectedItem.
  In case that the selectedItem was cleared, the searchText will be not updated.

* The `searchText` should be updated / cleared, when the `selectedItem` got cleared.

Fixes angular#8788.
@devversion devversion added the has: Pull Request A PR has been created to address this issue label Jul 18, 2016
devversion added a commit to devversion/material that referenced this issue Jul 20, 2016
* Currently the autocomplete always updates the searchText according the changed selectedItem.
* When the selectedItem was manually cleared, the searchText will be not updated.
* The `searchText` should be cleared, when the `selectedItem` was cleared and the searchText still matches the selectedItem

Fixes angular#8788.
ThomasBurleson pushed a commit that referenced this issue Jul 24, 2016
* Currently the autocomplete always updates the searchText according the changed selectedItem.
* When the selectedItem was manually cleared, the searchText will be not updated.
* The `searchText` should be cleared, when the `selectedItem` was cleared and the searchText still matches the selectedItem

Fixes #8788.

Closes #9087
@Splaktar Splaktar removed this from the - Backlog milestone Feb 23, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
has: Pull Request A PR has been created to address this issue needs: investigation The cause of this issue is not well understood and needs to be investigated by the team or community
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants