当我通过 http 调用收到错误时,我试图显示一个小吃吧 =>
constructor(
private actions$: Actions,
private getuserService: UserService,
private snackBar: MatSnackBar
) { }
@Effect()
getUser$ = this.actions$.pipe(
ofType<featureActions.getUser>(featureActions.ActionTypes.getUser),
switchMap(() =>
this.getuserService.getUser().pipe(
map(user => new featureActions.getUserSuccess(user)),
catchError((error: HttpErrorResponse) => {
this.snackBar.open("error message", 'OK', {duration: 2000});
return of(new featureActions.GetUserFailed(error))
}),
),
),
);
我已经在我的 AppModule 中导入了所有材质模块,包括 MatSnackBarModule。
但是,当我显示它时,页面左上角的 div 是这样的
没有错误,我不会在任何地方覆盖任何材质 css。我不太明白我的错误。此外,当我检查时,所有的 css 类等都被应用。