使用$ compile angujar.js时出错

时间:2015-11-16 17:23:46

标签: javascript html angularjs pug

我正在使用angular.js处理项目。编译时遇到问题。

在程序的先前版本中,它显示了包含数据的表(当currentProduct是单个变量时)。但是现在我正在使用数组,并且数组编译得不好。

它与它有什么关系,曾经是一个普通变量,现在是一个变量数组吗?

错误:

enter image description here

我正在使用此方法添加新的div。

// trae los datos de la tabla
Product.getPriceTable({id:product.id},function (result) {
  product.hasPriceTable = true;
  product.priceTable = result.priceTable;
  var directive = '<div editable-price-table price-table="currentProduct[product.id].priceTable" product="currentProduct[product.id]" user="currentUser"  />';
  var linkFn = $compile(directive);
  var content = linkFn($scope);
  angular.element('#price-table-' + product.id).append(content);
});

错误在变量指令中。

代码无法在此行编译:

var linkFn = $compile(directive);

0 个答案:

没有答案
相关问题