Angular 如何修复类型为';{static:boolean;}';不可分配给类型为';{read?:any;}';。有棱角的?

Angular 如何修复类型为';{static:boolean;}';不可分配给类型为';{read?:any;}';。有棱角的?,angular,Angular,我将html文件定义为: <div class="dialogBox"> <ng-template #callAPIDialog> <h2 mat-dialog-title class="dialogHeading">Scale Dimensions</h2> <p> <mat-form-field> <mat-label>Width</mat-label&g

我将html文件定义为:

<div class="dialogBox">
  <ng-template #callAPIDialog>
    <h2 mat-dialog-title class="dialogHeading">Scale Dimensions</h2>
    <p>
      <mat-form-field>
        <mat-label>Width</mat-label>
        <input matInput placeholder="Enter width (in ft)" #width name="width">
        <mat-hint>Enter width in number</mat-hint>
      </mat-form-field>
    </p>
    <p>
      <mat-form-field>
        <mat-label>Height</mat-label>
        <input matInput placeholder="Enter height (in ft)" #height name="height">
        <mat-hint>Enter height in number</mat-hint>
      </mat-form-field>
    </p>
    <!-- <mat-dialog-actions> -->
    <button mat-raised-button (click)="scaleDrop(height.value,width.value)" class="buttonConfirm">CONFIRM</button>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <button mat-raised-button (click)="closeDialogBox()" class="buttonCancel">CANCEL</button>

    <!-- </mat-dialog-actions> -->
  </ng-template>
</div>

比例尺寸

宽度
在数字中输入宽度

高度 在数字中输入高度

证实 取消
在我的ts文件中,我将其命名为:

@ViewChild('callAPIDialog', { static: false }) callAPIDialog: TemplateRef<any>;
  callAPI() {
............}
@ViewChild('callapialog',{static:false})callapialog:TemplateRef;
callAPI(){
............}
然而,我得到的错误如下:

@ViewChild('callAPIDialog', { static: false }) callAPIDialog: TemplateRef<any>;
  callAPI() {
............}
{static:boolean;}
类型的参数不能分配给
{read?:any;}
类型的参数。 对象文字只能指定已知属性,并且类型
{read?:any;}
中不存在
static


如何修复它?

您使用的是什么角度?您的角度版本是什么<代码>静态标志随v.8一起提供如果您使用的是v7,它会抛出此错误