components icon indicating copy to clipboard operation
components copied to clipboard

md-select : selected value doesn't change after md-option text is changed using fxHide

Open dhuallanca opened this issue 9 years ago • 3 comments

Bug, feature request, or proposal:

Bug

What is the expected behavior?

Selected value should change according to md-option values. Whether md-option is updated selected value should change

What is the current behavior?

Selected value doesn't change the value after fxHide is called and md-option values are changed

What are the steps to reproduce?

  1. Open a browser
  2. Change the size of the browser to (lt-md)
  3. md-option should hide some information in responsive (lt-md)

https://plnkr.co/edit/L5XWZW7ew4gym47nPHaZ?p=preview

What is the use-case or motivation for changing an existing behavior?

For responsive design, I need to hide some elements in mdoptions.

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

"@angular": "^4.3.3", "@angular/flex-layout": "2.0.0-beta.8", "@angular/material": "^2.0.0-beta.8",

Is there anything else we should know?

For responsive design I hide an element (food.value) in md-option, however the selected value doesn't refresh the change in md-option

dhuallanca avatar Aug 08 '17 19:08 dhuallanca

The viewValue of the trigger is calculated from this

  // option.ts
  get viewValue(): string {
    return (this._getHostElement().textContent || '').trim();
  }

And since fxHide doesn't actually remove the text from the DOM, it is still read as a part of textContent. To customize the trigger display value, https://github.com/angular/material2/pull/3341 will be merged soon.

willshowell avatar Aug 08 '17 19:08 willshowell

the problem is solved using md-select-trigger.

dhuallanca avatar Sep 06 '17 17:09 dhuallanca

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.