I am currently working with the following code:
<script id="templates/orderdetails.html" type="text/ng-template">
<ion-view view-title="OrderDetails">
<ion-content class="padding">
<p>Here I want to display order details...</p>
{{ detail }}
<script type="text/javascript">
var obj = JSON.parse( {{ detail }} );
document.write('<table>');
document.write('<thead>');
document.write('<tr>');
document.write('<th>菜名</th><th>单价</th><th>份数</th><th>小计</th>');
document.write('</tr>');
document.write('</thead>');
document.write('<tbody>');
document.write('</tbody>');
document.write('</table>');
for(id in obj) {
document.write(obj[id]["name"]);
document.write(" ");
document.write(obj[id]["price"]);
document.write(" ");
document.write(obj[id]["num"]);
document.write(" ");
document.write(obj[id]["total"]);
document.write("<br>");
}
</script>
<p>
<a class="button icon ion-home" href="#/tab/home"> Home</a>
</p>
</ion-content>
</ion-view>
</script>
I would like the content of {{ detail }} to be parsed and displayed as shown in this image: enter link description here
However, I have encountered an issue where JavaScript is not functioning within "
<script id="templates/orderdetails.html" type="text/ng-template">
". How can I resolve this? Thank you.