ngOfficeUIFabric / ng-officeuifabric

Office UI Fabric (https://github.com/OfficeDev/office-ui-fabric) implementation for Angular
http://ngOfficeUiFabric.com
MIT License
321 stars 67 forks source link

Encoded ampersand displays in selected option of dropdown #487

Closed nightullr closed 7 years ago

nightullr commented 7 years ago

The selected value of uif-dropdown displays an encoded ampersand, "&", rather than the character. The model value contains the & character as do the options in the drop down list - only appearance of this issue seems to be in the display box.

Plunk: http://embed.plnkr.co/C4RnVQrgtHfD8DBBjuGE/

image

jjczopek commented 7 years ago

I suspect the problem is with the following line: https://github.com/ngOfficeUIFabric/ng-officeuifabric/blob/master/src/components/dropdown/dropdownDirective.ts#L132

We have to evaluate if it's safe to remove the .html() call.

nightullr commented 7 years ago

This line, as well: https://github.com/ngOfficeUIFabric/ng-officeuifabric/blob/master/src/components/dropdown/dropdownDirective.ts#L71

The one you linked is hit on initial load to set the value, but the postLink click event seems to be the one executed when changing it. This directive is using interpolation for selectedTitle and not ng-bind-html, so I don't think I see an impact in changing those two lines to use .text() rather than .html() - unless having html within a drop down option display value is desired. Technically you already can, it just doesn't work when you select one.

nightullr commented 7 years ago

@jjczopek - I can confirm that the change to .text() on lines 71 and 132 does not cause any impacts, especially considering that attempting to properly utilize .html() with HTML content just displays it as plaintext anyway. I made the switch in my local dev copy a couple weeks ago and it behaves correctly. Can I get a pull request submitted? I attempted to submit one myself but Github does not allow me to... insufficient permissions error. I haven't submitted one before, though, so I'm unsure if there was a step I missed. Thanks!

andrewconnell commented 7 years ago

@nightullr - We'd welcome your PR!

If you're trying to create a branch off your cloned copy of THIS repo, then you are correct you won't be able to submit a PR. We aren't doing anything special here... submit the PR from your fork like all other OSS projects :)

The proper process is:

details here: https://github.com/ngOfficeUIFabric/ng-officeuifabric/blob/master/docs/guides/PULL-REQUESTS.md

Feel free to post questions if you're still having trouble so we can get you sorted.

nightullr commented 7 years ago

Yep, that's what I did! Thanks for the clarification. Submitted the PR.