我一直在面对一个问题很长一段时间。你能帮我解决这个问题吗?其实,我想在很多地方使用table指令。所以我创建了一个指令并将角度UI网格绑定到它。但我得到编译错误。Angular:编译未定义
Error: angular.min.js:102 ReferenceError: compile is not defined
但我可以加载网格内容
我做错了的是什么?
HTML
<div ng-controller="ctrl1 as two">
<ltcg-table><ltcg-table>
</div>
<div ng-controller="ctrl2 as two">
<ltcg-table><ltcg-table>
</div>
JS
myApp.directive('ltcgTable', function($compile) {
return {
restrict: 'E',
transclude: true,
replace: false,
scope: { },
controller: Controller,
controllerAs: 'Controller',
bindToController: true,
compile: compile
}
});
我不知道它会做什么,而是使用'compile:$ compile',而不是'compile:compile'。 – Roy
谢谢。但在使用编译时:$ compile获取错误angular.min.js:102错误:[$ compile:multidir] http://errors.angularjs.org/1.3.15/$compile/multidir?p0=ltcgTable&p1=uiGrid...p3 =%3Cltcg-table%20ui-grid%3D%22gridOptions%22%20class%3D%22ng-scope%22%3E – klmuralimohan