angular2-mdl-ext icon indicating copy to clipboard operation
angular2-mdl-ext copied to clipboard

[MDL-SELECT]Text not showing after selection

Open Pomelool opened this issue 8 years ago • 2 comments

<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.

Pomelool avatar Jul 17 '17 18:07 Pomelool

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

adasq avatar Sep 29 '17 08:09 adasq

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();

piotrekdonicz avatar Oct 09 '17 12:10 piotrekdonicz