【发布时间】:2022-07-19 15:33:44
【问题描述】:
当我将 MatProgressSpinnerModule 加载到 app.module.ts 中时,出现“stacktrace”为空的 NG0203 错误:
tQ https://localhost:44378/client/main.js?v=tGcUggioS9SQmuEwtHgBh_nWyK0V2FItGwwRHNtEq90:1
re https://localhost:44378/client/main.js?v=tGcUggioS9SQmuEwtHgBh_nWyK0V2FItGwwRHNtEq90:1
fac https://localhost:44378/client/main.js?v=tGcUggioS9SQmuEwtHgBh_nWyK0V2FItGwwRHNtEq90:1
hydrate https://localhost:44378/client/main.js?v=tGcUggioS9SQmuEwtHgBh_nWyK0V2FItGwwRHNtEq90:1
get https://localhost:44378/client/main.js?v=tGcUggioS9SQmuEwtHgBh_nWyK0V2FItGwwRHNtEq90:1
_resolveInjectorDefTypes https://localhost:44378/client/main.js?v=tGcUggioS9SQmuEwtHgBh_nWyK0V2FItGwwRHNtEq90:1
_resolveInjectorDefTypes https://localhost:44378/client/main.js?v=tGcUggioS9SQmuEwtHgBh_nWyK0V2FItGwwRHNtEq90:1
PM https://localhost:44378/client/main.js?v=tGcUggioS9SQmuEwtHgBh_nWyK0V2FItGwwRHNtEq90:1
create https://localhost:44378/client/main.js?v=tGcUggioS9SQmuEwtHgBh_nWyK0V2FItGwwRHNtEq90:1
wA https://localhost:44378/client/main.js?v=tGcUggioS9SQmuEwtHgBh_nWyK0V2FItGwwRHNtEq90:1
invoke https://localhost:44378/client/polyfills.js:1
onInvoke https://localhost:44378/client/main.js?v=tGcUggioS9SQmuEwtHgBh_nWyK0V2FItGwwRHNtEq90:1
invoke https://localhost:44378/client/polyfills.js:1
run https://localhost:44378/client/polyfills.js:1
run https://localhost:44378/client/main.js?v=tGcUggioS9SQmuEwtHgBh_nWyK0V2FItGwwRHNtEq90:1
bootstrapModuleFactory https://localhost:44378/client/main.js?v=tGcUggioS9SQmuEwtHgBh_nWyK0V2FItGwwRHNtEq90:1
wA https://localhost:44378/client/main.js?v=tGcUggioS9SQmuEwtHgBh_nWyK0V2FItGwwRHNtEq90:1
invoke https://localhost:44378/client/polyfills.js:1
run https://localhost:44378/client/polyfills.js:1
F https://localhost:44378/client/polyfills.js:1
invokeTask https://localhost:44378/client/polyfills.js:1
runTask https://localhost:44378/client/polyfills.js:1
L https://localhost:44378/client/polyfills.js:1
promise callback*d https://localhost:44378/client/polyfills.js:1
scheduleTask https://localhost:44378/client/polyfills.js:1
scheduleTask https://localhost:44378/client/polyfills.js:1
scheduleMicroTask https://localhost:44378/client/polyfills.js:1
F https://localhost:44378/client/polyfills.js:1
then https://localhost:44378/client/polyfills.js:1
bootstrapModule https://localhost:44378/client/main.js?v=tGcUggioS9SQmuEwtHgBh_nWyK0V2FItGwwRHNtEq90:1
636 https://localhost:44378/client/main.js?v=tGcUggioS9SQmuEwtHgBh_nWyK0V2FItGwwRHNtEq90:1
n https://localhost:44378/client/runtime.js:1
<anonymous> https://localhost:44378/client/main.js?v=tGcUggioS9SQmuEwtHgBh_nWyK0V2FItGwwRHNtEq90:1
a https://localhost:44378/client/runtime.js:1
<anonymous> https://localhost:44378/client/main.js?v=tGcUggioS9SQmuEwtHgBh_nWyK0V2FItGwwRHNtEq90:1
app.module.ts:
import { BrowserModule } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { HttpClientModule } from "@angular/common/http";
import { HTTP_INTERCEPTORS } from '@angular/common/http';
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
import { AppComponent } from './app.component';
import { SongbookService } from './services/songbookService';
import router from './router';
import { InterceptorService } from './services/InterceptorService';
import { SpinnerService } from './services/spinnerService';
@NgModule({
declarations: [
AppComponent,
],
imports: [
BrowserModule,
HttpClientModule,
BrowserAnimationsModule,
MatProgressSpinnerModule,
router
],
providers: [
SongbookService,
{ provide: HTTP_INTERCEPTORS, useClass: InterceptorService, multi: true },
SpinnerService
],
bootstrap: [AppComponent]
})
export class AppModule { }
我不知道如何修复它,当我在 NgModule 导入中重新输入 MatProgressSpinnerModule 时 - 不会出现错误。 ngx-spinner 也有同样的问题。
如果它在 .NET 应用程序中的 SPA 很重要
【问题讨论】:
-
你有没有发现你的问题?
-
我遇到了这个错误,在我的情况下,我开发的一个库需要 ngRx 并且缺少一些配置。要了解原因是什么,诀窍是使用禁用优化添加 --optimization=false 来构建项目。如果你这样做,控制台上的错误应该很清楚。
标签: angular angular-cli