javascript - 默认情况下,ngx-toaster 在屏幕的错误位置通知
问题描述
这是 它在上面默认显示通知的问题,也许它受到 CSS 属性的影响?
当我像这样在模块的导入中配置位置时:
imports: [
...
...,
ToastrModule.forRoot(
positionClass: 'toastr-bottom-right'
)
]
好吧,当我这样做时,它会将通知放在左上角,此外没有显示任何消息,正如您在屏幕截图中看到的那样,它只是一个红色(错误)toastr 通知但为空,即使我确实通过了当用户未正确登录时通知消息。
这是我的组件代码
export class NavComponent {
...
...
...
model: any = {};
loggedIn: boolean;
constructor(
private accountService: AccountService,
private router: Router,
private toastr: ToastrService
) { }
...
...
login(){
this.accountService.login(this.model).subscribe(response => {
this.router.navigateByUrl('/agents');
}, errorResponse => {
console.log(errorResponse);
this.toastr.error(errorResponse.eror);
});
}
我正在使用 Angular 10。
解决方案
在这里检查底部的拼写。
ToastrModule.forRoot({
timeOut: 10000,
positionClass: 'toast-bottom-right',
}),
你可以忽略timeOut
这里。
推荐阅读
- angular - 使用下拉列表第二次过滤表不返回任何内容
- javascript - CraftCMS - CraftQL 查询全局变量总是返回错误
- android - 使用默认 animateLayoutChanges 时滚动视图出现故障
- node.js - googleapis npm 模块文档
- amazon-web-services - Docx Document Serverless S3 错误,而 Putobject 方法
- c# - ASP.NET MVC 模板项目不能开箱即用
- python - Powershell Invoke-Command inDisconnected 会话超时?
- javascript - 在程序的不同阶段使用小吃店功能的不同元素
- c# - 如果应用程序在屏幕保护程序下启动,MainWindow 将保持隐藏状态
- ios - `NSLayoutConstraint`的内存泄漏