我使用coverage.js用於顯示數據。與coverage.js傳遞響應,產生錯誤
當我通過我的變量(其中我得到覆蓋響應)到HTML文件作爲我們這樣做的角度來顯示錶達式,它提供了語法錯誤:
<div class="container" style="margin-top: 40px">
<div id="jsonAnswer" class="jsonAnswer" style="display: none">
{{coveragedetailjson}}
</div>
</div>
其中coveragedetailjson是我的變量在那裏我得到我作爲一個JSON響應
var data = $.parseJSON($("#jsonAnswer").html());
var coverage = new Coverage(data);
buildCoverageHTML = function (coverage) {
$(".coverage-section").remove();
var plugin = new CoveragePlugin(coverage);
// Adds the demographic section
plugin.addEligibleMetadataSection();
plugin.addDemographicsSection();
plugin.addInsuranceSection1();
plugin.addInsuranceSection2();
plugin.addInsuranceSection3();
plugin.addPlanMaximumMinimumDeductibles();
plugin.addPlanCoinsurance();
plugin.addPlanCopayment();
plugin.addPlanDisclaimer();
plugin.addAdditionalInsurancePolicies();
plugin.addGenericServices();
$('body').append(plugin.coverageSection);
};
buildCoverageHTML(coverage);
在腳本標籤
我使用的小提琴上面的代碼:
https://jsfiddle.net/Eligible/pqspk8gf/?utm_source=website&utm_medium=embed&utm_campaign=pqspk8gf
SyntaxError : Unexpected token {
將代碼請 –
後一些代碼,你試過嗎? –
我已添加代碼@ÁlvaroTouzón – Priyanka