javascript - AngularJs filter:$viewValue is not handling html escaping -


If you type A in the box, you will see:

  1. Alabama is missing
  2. Alaska is ok
  3. 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

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -