我準備在Angular 12中使用MatFormFieldModule。
我從@angular/material和@NgModule中匯入這個模塊,如下所示:
import {MatFormFieldModule} from '@angular/material';
@NgModule({
....
進口。[
MatFormFieldModule,
...
],
...
})
并且在html檔案中使用這個MatFormFieldModule
<mat-form-field>
...
</mat-form-field>
但我得到的錯誤是這樣的:
Error: src/app/app.module.ts:9:3 - error TS2305: Module '"@angular/material"' has no exported member 'MatFormFieldModule'.
9 MatFormFieldModule
不確定問題所在。
uj5u.com熱心網友回復:
如果你查看材料表單域的檔案,你可以注意到MatFormFieldModule的正確匯入路徑是@angular/material/form-field。請嘗試這樣做:
從'@angular/material/form-field'匯入{MatFormFieldModule}。
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/307500.html
標籤:
