Knockout JS option binding special symbols

840 views Asked by At

i have array

self.CompareSignArray = ko.observableArray(["&gt", "&le"]);

and select option

 <select data-bind="options:  $root.CompareSignArray,value: Sign" ></select>

but in dropdown i see &gt &le, but i want see "> " and ≤ what solve of problem

2

There are 2 answers

0
SOReader On

It's JS. Use regular characters like here:

self.CompareSignArray = ko.observableArray([">", "<"]);
0
Tanner On

Just add the characters you to the array:

self.CompareSignArray = ko.observableArray([">", "≤"]);

See here: http://jsfiddle.net/V4GvT/

HTML:

<select data-bind="options:  CompareSignArray" ></select>

JS:

function viewmodel()
{
    var self = this;
    self.CompareSignArray = ko.observableArray([">", "≤"]);
}
ko.applyBindings(new viewmodel());