我想使用Angular Material Progress微調組件。但是,如果我輸入無法解析MatProgressSpinner的所有參數
import {MatProgressSpinnerModule} from '@angular/material';
我得到以下錯誤在控制檯:
無法解決所有參數MatProgressSpinner:([目標對象],[目標對象],[目標對象] ,?)。
然而,如果以同樣的方式我輸入:
import {MatProgressBarModule} from '@angular/material';
進度條正常工作。
依賴關係:
"dependencies": {
"@angular/animations": "^4.1.3",
"@angular/cdk": "^2.0.0-beta.12",
"@angular/common": "^4.0.0",
"@angular/compiler": "^4.0.0",
"@angular/core": "^4.0.0",
"@angular/flex-layout": "^2.0.0-beta.9",
"@angular/forms": "^4.0.0",
"@angular/http": "^4.0.0",
"@angular/material": "^2.0.0-beta.12",
"@angular/platform-browser": "^4.0.0",
"@angular/platform-browser-dynamic": "^4.0.0",
.....
"hammerjs": "^2.0.8",
....
},
當我運行ng serve
我看到這樣的警告:在./~/@angular/material/esm5/progress-spinner.es5.js 230
警告:在'@ angular/common'中找不到'export'DOCUMENT'
警告在./~/@angular/material/esm5/progress-spinner.es5.js 283:83-91「export'DOCUMENT'在'@ angular/common'中找不到'
如何正確導入MatProgressBarModule
?
問題可能在於您嘗試使用「MatProgressSpinner」,而不是導入本身。你能提供它的代碼片段嗎?你使用AoT構建? –
當我只導入模塊但尚未使用時出現問題。 – Vetos
我明白了。我認爲問題在於你已經過時了角度版本,這與您使用的角度/材質版本不兼容。 –