从8.2到9.1的角度更新->角度材料错误:“ mat-radio-button”不是已知元素

时间:2020-10-05 09:50:32

标签: angular typescript angular-material angular9 angular-ivy

从那时起,我刚刚执行了Angular更新,并收到了以下有关角度材料的错误消息:

组件LanguageChangeComponent的模板中发生错误。 src /app/common/language-change/language-change.component.html:9: 9-错误NG8001:“ mat-radio-button”不是已知元素:

  1. 如果“ mat-radio-button”是Angular组件,请验证它是否属于此模块。
  2. 如果“ mat-radio-button”是Web组件,则将“ CUSTOM_ELEMENTS_SCHEMA”添加到该组件的“ @ NgModule.schemas” 禁止显示此消息。

我认为该模块已正确导入,但错误消息并没有消失。我在做什么错了?

该组件如下所示(模板):

expanded_df <- df[rep(seq_len(dim(df)[1]),
                      df$total_goals_scored), ]

相关模块如下:

<my-sidebar class="language-selection">
  <div class="header">
    <span>{{ cfg.title }}</span>
  </div>
  <div class="language-selection-radio-buttons">
    <section>
      <mat-radio-group [(ngModel)]="languageSelection">
        <mat-radio-button value="en" [checked]="languageSelection === 'en'">Englisch</mat-radio-button>
        <mat-radio-button value="de" [checked]="languageSelection === 'de'">Deutsch</mat-radio-button>
      </mat-radio-group>
    </section>
  </div>
  <div class="buttons">
    <button class="button-primary" (click)="changeDefaultLanguage()">change</button>
  </div>
</my-sidebar>

这是我的package.json的摘录:

import { CommonModule } from '@angular/common';
import { LanguageChangeComponent } from './language-change.component';
import { MySideBarModule } from '@my-sidebar/core';
import { FormsModule } from '@angular/forms';
import { TranslateModule } from '@ngx-translate/core';
import { MatRadioModule } from '@angular/material/radio';

@NgModule({
  imports: [
    CommonModule,
    MySideBarModule,
    MatRadioModule,
    FormsModule,
    TranslateModule
  ],
  declarations: [
    LanguageChangeComponent
  ],
  exports: [
    LanguageChangeComponent
  ]
})
export class LanguageChangeModule { }

0 个答案:

没有答案