You need to add the {{id}} in the href, like that :
href="#product_detail?{{id}}"
We used to put our mustache template in a script with type="text/template", i don't know if it will solve your escaping problems but we haven't here.
<script type="text/template" id="tmpl">
<a href href="#product_detail?{{id}}">link</a>
</script>
If you got some escaping problems use the & before the id like that:
<script type="text/template" id="tmpl">
<a href href="#product_detail?{{& id}}">link</a>
</script>
Hope it help !