javascript - AngularJs filter:$viewValue is not handling html escaping -
If you type A in the box, you will see:
- Alabama is missing
- Alaska is ok
- Arizona displays okay but once the selected code has
& amp; Lt; and
& amp; Gt; / p>
& lt; Div class = "container" & gt; & Lt; Div ng-controller = "mainCtrl" class = "row-liquid" & gt; & Lt; Form range = "line-fluid" & gt; & Lt; Div class = "container-liquid" & gt; & Lt; Input type = "text" ng-model = "selected" typeahead = "state for status in states: filter: $ visual value" / & gt; & Lt; / Div & gt; & Lt; / Form & gt; & Lt; / Div & gt; & Lt; / Div & gt;
...
Angular Module ('myApp', ['ui.bootstrap']). Controller ("Main", Function ($ scope) {$ scope.selected = ''; $ scope.states = ['Alabama & lt; Where is it & gt;', 'Alaska [This is OK]', 'Arizona & Amp; lt; Select & amp; gt; '];});
There is one not-so-beautiful way to solve this problem as it is sanitize Apply filters to your array elements, and then when they are selected, make them uncertain.
$ radius $ Watch ('selected', function () {$ scope.selected = $ scope (replace new RegExp ('& amp; lift;', 'g'), '& lt;') (New RegExp ('& amp; ;};} Angular.module ('myApp'). Filters ('Sanitizer', function) {Return function (item) {var filtered = []; angular Units (items, functions) {filtered.push (item.replace new RegExp ('& lt;', 'g'), '& amp; lt;'). Replace (New RegExp ("& gt; ", 'G')," & amp; gt; "));}); Filter back;}});
Comments
Post a Comment