Skip to content
This repository was archived by the owner on Sep 5, 2024. It is now read-only.
This repository was archived by the owner on Sep 5, 2024. It is now read-only.

Using <md-select> with <md-option> of '<' fails #5847

@djmarcus1

Description

@djmarcus1

I use <md-option> to display math boolean operators for the user to select.

<md-select ng-model="operator" style="width: 75px" aria-label="Select comparison operator">
  <md-option ng-value="lessThan">&lt;</md-option>
  <md-option ng-value="lessThanEqual">&lt;=</md-option> 
  <md-option ng-value="equal">=</md-option>
  <md-option ng-value="true">true</md-option>
</md-select>

See codepen: http://codepen.io/djmarcus/pen/avMeod

When I select the < option, the selected value becomes =.

When I do the same thing using a regular <select>, it works:

<select>
  <option value="lessThan">&lt;</option> 
  <option value="lessThanEqual" selected>&lt;=</option>
  <option value="equal">=</option>
  <option value="true">true</option>
</select>

A personal guess on what is going on:

I see, using Chrome DOM element inspection, that the DOM generated is something like:

<md-select-value class="md-select-value" id="select_value_label_137">
  <span>=</span>
  <span class="md-select-icon" aria-hidden="true"></span>
</md-select-value>

Note the <span>=</span>

I assume one of these is generated for each <md-option>.

So, my first option is &lt; which would generate a <

So if it tries to generate <span><</span> there would be a problem.

Just a guess. I tried single-stepping the code with a debugger but could not follow all the transformations that take place :-(

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions