Skip to content
This repository has been archived by the owner on Jun 16, 2019. It is now read-only.

[MDL-SELECT]Text not showing after selection #928

Open
Pomelool opened this issue Jul 17, 2017 · 2 comments
Open

[MDL-SELECT]Text not showing after selection #928

Pomelool opened this issue Jul 17, 2017 · 2 comments

Comments

@Pomelool
Copy link

<mdl-select [(ngModel)] = "om">
<mdl-option [value]="a">a
<mdl-option [value]="b">b

With this, there will be no text showing on the select bar. Choices can be seen and checked, but nothing would be shown as a result in the bar.

@adasq
Copy link
Contributor

adasq commented Sep 29, 2017

Can you give some details of it? What kind of values are a and b variables?

@piotrekdonicz
Copy link
Contributor

piotrekdonicz commented Oct 9, 2017

I've run into the same problem, here you have an example
<mdl-select placeholder="Select">
<mdl-option value="first">First Text</mdl-option>
<mdl-option value="second">Second Text</mdl-option>
</mdl-select>
did quick check and propblem appears when we do not use ngModel (or any other directive in mdl-option), in the example above, this code is executed after this, so text property stays undefined and select is not displaying text from selected option.

When we use ngModel, the code is executed in corect order and everything works as expected.

One of the options to fix that would be to change
this.textByValue[this.stringifyValue(selectOptionComponent.value)] = selectOptionComponent.text;
to
this.textByValue[this.stringifyValue(selectOptionComponent.value)] = selectOptionComponent.contentWrapper.nativeElement.textContent.trim();

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants