This issue was raised initially with amp-mustache #8395 and was resolved to some extent. But what about usage when someone is using apostrophe or other escape characters outside the template.
for example:
<button on="tap:AMP.setState({
message:'Hello I'm John Doe'
})">
Hello
</button>
<p [text]="message">HI</p>
Here, Console is throwing error:
%s %s amp-bind: Expression eval failed. Parse error on line 2:
... message:'Hello I'm John Doe'
-----------------------^
Expecting 'EOF', ')', '-', '+', '*', '/', '%', '&&', '||', '<=', '<', '>=', '>', '!=', '==', '?', ':', '.', ',', '[', ']', '}', got 'NAME'​​​
And one can't use backslash escaping or html's '. The solution provided in issue #8395 converts the content to text.
One solution can be allowing backslash escaping or HTML predefined characters entities should be allowed to be used in amp components.
I like the idea of allowing backslashes to escape the quote.
Like JSON and double quotes
Most helpful comment
I like the idea of allowing backslashes to escape the quote.