Skip to content

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

Closed

Description

@dhuallanca

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

Activity

  1. willshowell commented on Aug 8, 2017

    @willshowell
    Contributor

    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, #3341 will be merged soon.

  2. dhuallanca commented on Sep 6, 2017

    @dhuallanca
    Author

    the problem is solved using md-select-trigger.

  3. angular-automatic-lock-bot commented on Sep 7, 2019

    @angular-automatic-lock-bot

    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.

  4. locked and limited conversation to collaborators on Sep 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions