0

当我单击按钮时,mat-menu 未显示。ng 容器位于垫表中。任何想法 ?

Angular 版本 Angular CLI:11.2.15 节点:14.17.2 操作系统:win32 x64

Angular:11.2.14 ...动画,通用,编译器,编译器cli,核心,表单...平台浏览器,平台浏览器动态,路由器常春藤工作区:是

包版本

@angular-devkit/架构师 0.1102.15

@angular-devkit/build-angular 0.1102.15

@angular-devkit/核心 11.2.15

@angular-devkit/原理图 11.2.15

@角/cdk 11.2.13

@角/cli 11.2.15

@角/元素 12.2.13

@角/语言服务7.2.4

@角/材料 11.2.13

@原理图/角度 11.2.15

@原理图/更新 0.1102.15

rxjs 6.6.7

打字稿4.1.6

  <th mat-header-cell *matHeaderCellDef>
    <b>{{ label || name }}</b>
  </th>
  <td mat-cell *matCellDef="let element">
    <button
      mat-icon-button
      [matMenuTriggerFor]="contextMenu"
      (click)="setRefToThis($event, element)"
    >
      <mat-icon>more_vert</mat-icon
      ><span class="sr-only"> {{ 'result.show_options_menu'| translate }}</span>
    </button>
  </td>
</ng-container>

<mat-menu #contextMenu="matMenu">
  <button>Hello</button>>
</mat-menu>
import {CdkStepperModule} from '@angular/cdk/stepper';
import {CdkTableModule} from '@angular/cdk/table';
import {CdkTreeModule} from '@angular/cdk/tree';
import { NgModule} from "@angular/core";
import { MatNativeDateModule } from '@angular/material/core';
import { MatAutocompleteModule } from '@angular/material/autocomplete';
import { MatBadgeModule } from '@angular/material/badge';
import { MatButtonModule } from '@angular/material/button';
import { MatButtonToggleModule } from '@angular/material/button-toggle';
import { MatCardModule } from '@angular/material/card';
import { MatCheckboxModule } from '@angular/material/checkbox';
import { MatChipsModule } from '@angular/material/chips';
import { MatStepperModule } from '@angular/material/stepper';
import { MatDatepickerModule } from '@angular/material/datepicker';
import { MatDialogModule } from '@angular/material/dialog';
import { MatExpansionModule } from '@angular/material/expansion';
import { MatFormFieldModule } from '@angular/material/form-field';
import { MatGridListModule } from '@angular/material/grid-list';
import { MatIconModule } from '@angular/material/icon';
import { MatInputModule } from '@angular/material/input';
import { MatListModule } from '@angular/material/list';
import { MatMenuModule } from '@angular/material/menu';
import { MatPaginatorModule } from '@angular/material/paginator';
import { MatProgressBarModule } from '@angular/material/progress-bar';
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
import { MatRadioModule } from '@angular/material/radio';
import { MatRippleModule } from '@angular/material/core';
import { MatSelectModule } from '@angular/material/select';
import { MatSidenavModule } from '@angular/material/sidenav';
import { MatSliderModule } from '@angular/material/slider';
import { MatSlideToggleModule } from '@angular/material/slide-toggle';
import { MatSnackBarModule } from '@angular/material/snack-bar';
import { MatSortModule } from '@angular/material/sort';
import { MatTableModule } from '@angular/material/table';
import { MatTabsModule } from '@angular/material/tabs';
import { MatToolbarModule } from '@angular/material/toolbar';
import { MatTooltipModule } from '@angular/material/tooltip';
import { MatTreeModule } from '@angular/material/tree';
import { MatDividerModule } from '@angular/material/divider';
import { MatBottomSheetModule } from '@angular/material/bottom-sheet';

NgModule({
exports: [
A11yModule,
CdkStepperModule,
CdkTableModule,
CdkTreeModule,
MatAutocompleteModule,
MatBadgeModule,
MatBottomSheetModule,
MatButtonModule,
MatButtonToggleModule,
MatCardModule,
MatCheckboxModule,
MatChipsModule,
MatStepperModule,
MatDatepickerModule,
MatDialogModule,
MatDividerModule,
MatExpansionModule,
MatGridListModule,
MatIconModule,
MatInputModule,
MatListModule,
MatMenuModule,
MatNativeDateModule,
MatPaginatorModule,
MatProgressBarModule,
MatProgressSpinnerModule,
MatRadioModule,
MatRippleModule,
MatSelectModule,
MatSidenavModule,
MatSliderModule,
MatSlideToggleModule,
MatSnackBarModule,
MatSortModule,
MatTableModule,
MatTabsModule,
MatToolbarModule,
MatTooltipModule,
MatTreeModule,
      ]
})
export class MaterialModule {}```


4

0 回答 0