<div id="divProductItems"></div>
上面的div將被一些html + angularjs元素填充,後面是來自單獨的js文件的ajax調用。但是,angularjs代碼目前無法正常工作。我怎樣才能解決這個問題如何編譯包含Angularjs的動態html代碼?
function getProductItems() {
var productSelected = $('#hdnSelectedProducts').val();
callActionWithJson("/Item/ProductItem", function (data) {
$("#divProductItems").html(data); // here I add the dynamic code to the above div and (data) contains the dynamic html + angularjs directives
filterProductItem();
}, null, "pricingLevelId", $("#ddlPricingLevel").val(), "searchItem", $("#txtSearchItem").val(), "productId", (productSelected.length != null ? productSelected : 0));
}
使用'$編譯()'編譯動態角碼 –
我看到,在一個類似類型的問題,請告訴我,在細節我不能與修復。如何使用$ compile()? –