我在component.ts上有角度2客户端我创建了一个ngOnInit
ngOnInit(){ var grid = document.getElementById('devpro'); grid.addEventListener('selected-items-changed', function() { var selected = grid.selection.selected(); if (selected.length == 1) { this.detailproject = []; var prodetails = grid.items[grid.selection.selected()].ProjectName; console.log(prodetails); this.getdetailsproject(prodetails); <<<<<< this part var detailsproject :any = document.getElementById('detailsproject'); if (detailsproject) { detailsproject.open(); } } }); } getdetailsproject(prodetails){ <<< this is my function this._httpprovider.httpReq('http://localhost:5000/getdetailsproject','POST',{ProjectName:prodetails},null).subscribe((data)=>{ var dprodetails = []; for (let i=0;i我尝试在里面调用它,没有任何结果只是一个错误说我的getdetailsproject不是一个函数
有没有办法像平时那样称呼它?
1> Volodymyr Bi..:在类型脚本中使用
grid.addEventListener('selected-items-changed', () => { })代替
grid.addEventListener('selected-items-changed', function() { });