【发布时间】:2017-08-24 19:00:09
【问题描述】:
如何从 slickgrid 自定义单元格编辑器调用角度服务。 下面提到了描述 slickgrid 自定义单元格编辑器的链接。
https://github.com/mleibman/SlickGrid/wiki/Writing-custom-cell-editors
function IEditor(args) {
this.applyValue = function(item,state) {
// Unable to get the service in the editor context.
// this.testService is undefined.
this.testService.getDetails(itemId).get(result =>{
console.log(result );
});
};
}
在编辑器上下文中获取服务时遇到问题。我尝试了 this 和 self 但没有成功。
【问题讨论】:
-
只需使用与stackoverflow.com/questions/42761100/… 相同的技术...在您的页面代码中的某处设置一个变量
this是您想要的,然后使用该变量