ClickerMonkey / SemanticUI-Angular

Angular Directives for Semantic UI
http://clickermonkey.github.io/SemanticUI-Angular/examples/
MIT License
56 stars 28 forks source link

icons in dropdown's default-text #19

Closed vannim152 closed 7 years ago

vannim152 commented 7 years ago

Not sure if s.o has encountered the same issue, but I will describe my case here. I have the following code:

<sm-dropdown default-text="'<i class=\'users icon\'></i> Select a user'"
class="my_dropdown"
model="..."
items="..."
label="...">
</sm-dropdown

In Chrome Developer Tools, when I execute $('.my_dropdown').dropdown('restore placeholder text'); or $('.my_dropdown').dropdown('restore default text'); or $('.my_dropdown').dropdown('restore defaults'); only the text (i.e. Select a user) is restored while I'm expecting the icon + text. Anybody has a solution or explanation?

vannim152 commented 7 years ago

After days of searching on Internet & forums, here is my band aid solution for the issue:

<sm-dropdown default-text="'<i class=&#34;users icon&#34;></i> Select a user'"
class="my_dropdown"
model="..."
items="..."
label="...">
</sm-dropdown>

$#34; is converted into double quotes.

Somewhere in the JavaScript code $('.my_dropdown').dropdown('set placeholder text', $('.my_dropdown').attr('default-text').replace(/[']/g, ""));