标签: ngx-toastr

NullInjectorError: StaticInjectorError(DynamicTestModule)[ToastrService -> InjectionToken ToastConfig]: 在 tslint angular 8

当我在 angular 8 项目中运行单元测试时,我在 ngx-toastr 中发现了一个错误

NullInjectorError: StaticInjectorError(DynamicTestModule)[ToastrService -> InjectionToken ToastConfig]:

我在spec.ts文件中导入了requierd模块,并且我还在app.module.ts中声明了forRoot()

  beforeEach(async(() => {
TestBed.configureTestingModule({
  imports: [MatTabsModule,
    ReactiveFormsModule,
    MatTooltipModule,
    HttpClientTestingModule,
    RouterTestingModule,
    ToastrModule
  ],
  declarations: [CommunicationComponent],
  providers: [
    ToastrService,
  ]
})
  .compileComponents();
Run Code Online (Sandbox Code Playgroud)

}));

unit-testing eslint angular ngx-toastr

8
推荐指数
1
解决办法
9620
查看次数

使用打字稿在 angular 6 中自定义 Ngx-toastr

嗨,我正在使用打字稿在 angular 6 中实现 Ngx-toastr,我的问题是我无法让它变得漂亮,因为我不知道在那个ngx-toastr类上覆盖了哪个 css我在Style上写了一些 css 。 css文件ngx-toastr并且我想要border-radius: 15px;但内部部分没有采用圆角border-radius: 15px;我从互联网上搜索了许多资源但没有得到正确的输出我无法更改其他 toastr 因为在我的项目中大约有350+ 组件我不想要使用方法更改每个文件,这就是为什么我想自定义现有的 toastr CSS。

这是我的 CSS 代码

.toast-container .ngx-toastr {
    position: relative;
    overflow: hidden;
    margin: 0 0 6px;
    padding: 15px 15px 15px 50px;
    width: 300px;
    border-radius: 15px !important;
    background-position: 15px center;
    background-repeat: no-repeat;
    background-size: 24px;
    box-shadow: 0 0 12px #999;
    color: #fff;
    border-image-source: linerar-gradient(red,purple) !important;
    border: 4px solid green !important;
    border-image-source: linear-gradient(red, purple) !important;
    border-image-slice: …
Run Code Online (Sandbox Code Playgroud)

notifications typescript angular ngx-toastr

4
推荐指数
1
解决办法
7720
查看次数

ngx-toastr - 通用类型“??ComponentDeclaration”需要 7 到 8 个类型参数

我已经安装了 ngx-toastr 并导入了 app.module.ts,但在编译时出现此错误, 在此处输入图像描述...是否是因为我在我创建的服务文件中设置了烤面包机的属性,如下所示?在此输入图像描述

我尝试添加 @import '~ngx-toastr/toastr.css'; 在 styles.css 中仍然没有效果。有谁知道此错误的原因可能是什么以及如何修复它

angular angular2-toaster ngx-toastr

4
推荐指数
1
解决办法
3453
查看次数

Angular JS ngx-toastr 错误:找不到模块:错误:包路径 ./public_api 未从包中导出

./src/app/nav/nav.component.ts:5:0-44 - 错误:找不到模块:错误:包路径 ./public_api 未从包 C:\Users\Score\demo\DatingApp\client 导出\node_modules\ngx-toastr (请参阅 C:\Users\Score\demo\DatingApp\client\node_modules\ngx-toastr\package.json 中的导出字段)

./src/app/register/register.component.ts:4:0-55 - 错误:找不到模块:错误:包路径 ./toastr/toastr.service 未从包 C:\Users\Score\demo 导出\DatingApp\client\node_modules\ngx-toastr (请参阅 C:\Users\Score\demo\DatingApp\client\node_modules\ngx-toastr\package.json 中的导出字段)[1]:https://i.stack。 imgur.com/WaZNB.png

angularjs ngx-toastr

3
推荐指数
1
解决办法
2045
查看次数

如何以编程方式隐藏 ngx-toaster?

我将 ngx-toaster 与disableTimeOuttrue 一起使用。所以它不会自动隐藏。但现在,当用户离开页面时(在 ngOnDestroy 方法内),我不会以编程方式隐藏它。我该怎么做?

this.toastr.error(message, status, {disableTimeOut: true});
Run Code Online (Sandbox Code Playgroud)

angular ngx-toastr

2
推荐指数
1
解决办法
3860
查看次数

类型“ToastInjector”中的属性“get”不可分配给基类型“Injector”中的同一属性

错误 TS2416:类型“ToastInjector”中的属性“get”无法分配给基本类型“Injector”中的同一属性。

\n

输入 \'(token: any, notFoundValue?: T, flags?: InjectFlags) => ToastPackage | T\' 不可分配给类型 \'{ (令牌:ProviderToken,notFoundValue:未定义,选项:InjectOptions & { 可选?: false; }):T;(令牌:ProviderToken,notFoundValue:null,选项:InjectOptions):T;(令牌:ProviderToken <...>,notFoundValue?:T,选项?:InjectOptions | InjectFlags):T;(令牌:ProviderToken<...>,而不是Fou...\'。

\n
Types of parameters \'flags\' and \'options\' are incompatible.\n  Type \'InjectOptions & { optional?: false; }\' is not assignable to type \'InjectFlags\'.\n
Run Code Online (Sandbox Code Playgroud)\n

toast-injector.ts

\n
import {Injector, InjectFlags} from \'@angular/core\xe2\x80\x99;\n\nimport { ToastPackage } from \'./toast-config\';\n\n\n\nexport class ToastRef<T> {\n\nexport class ToastInjector implements Injector {\n\n  constructor (\n\n    private _toastPck: ToastPackage,\n\n    private _parntInjtr: Injector\n\n  ) {}\n\n\n  //eslint-disable-next-line\n\n  get<T> …
Run Code Online (Sandbox Code Playgroud)

node.js typescript angular-toastr angular ngx-toastr

2
推荐指数
1
解决办法
3519
查看次数