我有两个Angular 6 javascript文件,一个服务和一个html文件:
grid.component.html
<ct-data-grid #grid class="grid"
[dataView]="collectionView"
[columns]="gridColumns"
[selectionMode]="5"
(dblclick)="onDoubleClick(grid)">
</ct-data-grid>
grid.component.ts
export class GridComponent {
public onDoubleClick(s: DataGridComponent): void {
// I want to call the putDataInService function from here
}
}
document-lookup-grid.component.ts
export class DocumentLookupGridComponent extends GridComponent {
constructor(private _documentDataService: DocumentService) {
}
public putDataInService(s: DataGridComponent): void {
this._documentDataService.doubleClickedData$ = s;
}
}
只能从 document-lookup-grid.component.ts 使用/调用该服务。
如果我将onDoubleClick
函数放在 document-lookup-grid.component.ts 中,则会收到以下错误消息:
错误 src / app / controls / lookup / grid / base / lookup-grid.component.html(9,15):: 类型“ LookupGridComponent”不存在属性“ onDoubleClick”。