1
我想在自定義的ag網格單元格編輯器中呈現一個角度自動完成指令。在渲染時,指令不編譯,而是在單元格編輯器中打印原始html。無論如何要讓它呈現爲角度指令?如何渲染ag-grid cellEditor組件內的角度指令?
我想在自定義的ag網格單元格編輯器中呈現一個角度自動完成指令。在渲染時,指令不編譯,而是在單元格編輯器中打印原始html。無論如何要讓它呈現爲角度指令?如何渲染ag-grid cellEditor組件內的角度指令?
我想出瞭解決方案,使用angular的$ compile將角度指令呈現爲html。
代碼:
CategoryEditor.prototype.init = function (params) {
this.container = document.createElement('div');
this.container.tabIndex = "0";
this.dropdown = document.createElement('div');
this.dropdown.setAttribute("dynamic", "html");
this.container.appendChild(this.dropdown);
//My directive is of the form <div dynamic="html"></div>
var that = this;
$scope.selectedCallback = function ($item) {
that.selectCategory($item);
params.stopEditing();
};
$compile(this.container)($scope);
$scope.$digest();
};
請確保您有angularCompileRows = true來獲得角1 AG-電網
只是沒有奏效內工作。我不得不使用$ compile來使它起作用。 – Karthik
這種方法適用於我 – Barif