angular2-mdl-ext
angular2-mdl-ext copied to clipboard
[MDL-SELECT]Text not showing after selection
<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.
Can you give some details of it? What kind of values are a and b variables?
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();