我在 Angular 6 中有以下代码:
import { Component, OnInit } from "@angular/core";
import { ActivatedRoute, Router } from "@angular/router";
...
export class someComponent implements OnInit {
life: string;
constructor(
private route: ActivatedRoute
) {}
ngOnInit(): void {
this.route.queryParamMap.subscribe(urlParams => this.life = urlParams.get('foo'));
}
...
}
Run Code Online (Sandbox Code Playgroud)
我已从 ActivatedRoute 实例化,我的目标是将url 中的route查询参数分配给名为 的变量之一。但是,我在 WebStorm 上收到以下警告(绿色卷线,所以我不确定它们是警告、错误还是其他内容):foolife
subscribe我得到Promise returned from subscribe is ignored的urlParams我得到Argument type (urlParams: any) => void is not assignable to parameter type …使用 ag-grid 和 ng7,我创建了一个自定义工具提示组件,将其绑定到列定义 tooltipComponent,以及 headertooltip 和 headername。当我将鼠标悬停在标题上时,console.log会调用 from agInit,但不会呈现模板
基于官方的 ag-grid 工具提示指南,有一种方法getGui可以渲染 html。也试过了,悬停在标题上时没有显示。
<ag-grid-angular
#agGrid
[frameworkComponents]="frameworkComponents"
...
></ag-grid-angular>
Run Code Online (Sandbox Code Playgroud)
headerName: 'Atheltes`
tooltipComponent: 'customTooltip',
headerTooltip: 'Helper text should show here'
this.frameworkComponents = { customTooltip: CustomTooltipComponent };
Run Code Online (Sandbox Code Playgroud)
@Component({
selector: 'ffp-tooltip-component',
template: `<div>It should show helper text</div>`,
})
export class CustomTooltipComponent implements ITooltipAngularComp {
agInit(params: ITooltipParams) {
console.log('this console log works!!')
// console.log above gets called, however, no template is shown.
}
getGui(): any {
}
} …Run Code Online (Sandbox Code Playgroud)