Search code examples
angularjsvelocityquote

How to escape single quotes in ng-init


Let's say we are passing data from apache velocity to angularjs and the data is some string that contain quotes,

the error on screen:

Error: [$parse:lexerr] http://errors.angularjs.org/1.2.22/$parse/lexerr?  
p0=Unterminated%20quote&p1=s%20327-

my code :

<span  ng-init='draftDemands=$draftDemands;'>

how to solve this problem


Solution

  • When i use $esc.xml($draftDemands), it work my last example,