ng-matero/extensions

MtxOption does not render & symbol

Closed this issue · 4 comments

Thanks for the repository
When using mtx-option in the mtx-select, the & symbol renders as '&amp'
This seems to only affect the & symbol as other symbols render as expected.

I suspect the issue is caused in line 543 of select.ts using the innerHTML as the value for the label
line 543: $ngOptionLabel: option.elementRef.nativeElement.innerHTML,

HTML

<mat-form-field>
  <mat-label>Choose an option</mat-label>
  <mtx-select>
    @for (food of items; track food) {
      <mtx-option [value]="food.id">
        {{food.name}}
       </mtx-option>
    }
  </mtx-select>
</mat-form-field>

TS

  items = [
    { id: 1, name: 'Apple &🎅' },
    { id: 2, name: 'Lemon &🕵️‍♀️' },
    { id: 3, name: 'Lime !@#$%^&*()-=' },
    { id: 4, name: 'Orange' },
    { id: 5, name: 'Strawberry' },
  ];

Expected
expected
Current
current

image

I don't find any issues. Can you provide an online demo?

I've recreated the issue in stackblitz

18.2.2 has fixed, please have a try.

The issue has been resolved in 18.2.2. Thank you.