Angular 无法在单元格渲染器中使用ngIf

Angular 无法在单元格渲染器中使用ngIf,angular,ag-grid,angular9,Angular,Ag Grid,Angular9,我正在尝试根据自定义单元格渲染器中的各种条件来显示或隐藏按钮 以下是我的渲染器的模板: <div class="btn-toolbar" style="justify-content: flex-start; display: flex;"> <button (click)="editStage()" type="button" class="btn-xs btn btn-prim

我正在尝试根据自定义单元格渲染器中的各种条件来显示或隐藏按钮

以下是我的渲染器的模板:

<div class="btn-toolbar" style="justify-content: flex-start; display: flex;">
    <button (click)="editStage()" type="button" class="btn-xs btn btn-primary btn-default btn-space"><span class="fas fa-edit"></span></button>
    <button (click)="gotoSteps()" type="button" class="btn-xs btn btn-primary btn-default btn-space"><span class="fas fa-code-branch"></span></button>
    <button *ngIf="stage.order > 0 && nbrStages > 1" (click)="moveUp()" type="button" class="btn-xs btn btn-primary btn-default btn-space"><span class="fas fa-arrow-up"></span></button>
    <button *ngIf="orderPlusOne < nbrStages && nbrStages > 1" (click)="moveDown()" type="button" class="btn-xs btn btn-primary btn-default btn-space"><span class="fas fa-arrow-down"></span></button>
   <button (click)="deleteStage()" type="button" class="btn-xs btn btn-primary btn-default btn-space"><span class="fa fa-trash-alt"></span></button>
</div>
在单元渲染器逻辑之外,我可以在应用程序中的任何其他位置的按钮上执行
ngIf
。在单元渲染器的上下文中,似乎没有正确加载某些内容

我曾尝试在模块的声明中添加
WorkflowStageButtonsComponent
,并在模块的导入中添加
CommonModule
,但没有奏效

有什么想法吗


编辑:我正在使用ag网格-angular@23.2.1

从提供组件的模块导入
CommonModule

@NgModule({

导入:[公共模块],//您需要在组件所在的模块中导入declared@v.kostenko目前,整个应用程序只有一个模块。您可以将按钮包装在ng容器中,并将*ngIf语句添加到该容器中作为快速修复。但这是异常行为。@FrancisDucharme您能提供一个关于plunker/stackblitz e的示例吗tc我刚刚尝试使用*ngIf-in,它工作得很好,奇怪的是,这在我去喝咖啡回来后就开始工作了…也许我不在的时候需要刷新/重新编译网页或其他什么?我没有马上工作。。。
@Component({
    selector: 'app-workflow-stage-buttons',
    templateUrl: './workflow-stage-buttons.component.html',
    styleUrls: ['./workflow-stage-buttons.component.css']
})
/** workflow-stage-buttons component*/
export class WorkflowStageButtonsComponent implements ICellRendererAngularComp {
    /** workflow-stage-buttons ctor */
    constructor() {

    }

    params: any;
    stage: WorkflowStage;
    nbrStages: number;
    orderPlusOne: number;
    

    refresh(params: any): boolean {
        return false;
    }

    agInit(params: import("ag-grid-community").ICellRendererParams): void {
        this.params = params;
        this.stage = <WorkflowStage>this.params.data;
        this.nbrStages = this.params.api.getRenderedNodes().length;
        this.orderPlusOne = this.stage.order + 1;
    }

    afterGuiAttached?(params?: import("ag-grid-community").IAfterGuiAttachedParams): void {

    }
}
Can't bind to 'ngIf' since it isn't a known property of 'button'.