Search code examples
angularjsangularjs-material

Special character display along with their name in md-select


I have md-select with the values from the database. The value having a name with special characters. I am using angularjs material.

Example: In database: Sathya & ram,

It displays like: Sathya &amp ram in md-option.

How can I resolve this?


Solution

  • You could wrap the value into a div with the directive ng-bind-html like this:

    <div ng-bind-html="$ctrl.name"></div>
    

    This directive evaluated Html, so use with care

    Docs for ngBindHtml

    EDIT

    I think you could also assign the directive to md-option directly.