gpt4 book ai didi

node.js - node_modules/ng2-toastr/src/toast-container.component.d.ts(1,48) : TS2305-/node_modules/@angular/core/core"' has no exported member 中的错误

转载 作者:太空狗 更新时间:2023-10-29 17:43:36 27 4
gpt4 key购买 nike

我有最新版本的 "rxjs": "^6.0.0"@angular/cli": "~6.0.8"当我运行 ng serve 时,我收到以下编译错误-

ERROR in node_modules/ng2-toastr/src/toast-container.component.d.ts(1,48): 
/node_modules/@angular/core/core"' has no exported member'AnimationTransitionEvent'.

imported toastermodule in the below format in my app.module.ts
import {ToastrModule} from 'ngx-toastr';

同时收到以下错误

error TS2305: Module '"C:/Users/user1/Sublime Text 3/NodeJS/groupchat-application/node_modules/rxjs/Observable"' has no exported member 'Observable'.
node_modules/rxjs/Observable.d.ts(1,15): error TS2307: Cannot find module 'rxjs-compat/Observable'.
imported as below in My service.ts
import { Observable, of} from "rxjs";

请指导如何进行

最佳答案

Use **ngx-toastr**

**steps to follow**

Install dependencies

1)npm install ngx-toastr --save
2)npm install @angular/animations --save

3)Add CSS to your angular.json file
"styles": [
"styles.scss",
"node_modules/ngx-toastr/toastr.css" // try adding '../' if you're using angular cli before 6
]

4)Add toastr module to your app.module.ts
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { ToastrModule } from 'ngx-toastr';

@NgModule({
imports: [BrowserAnimationsModule,
ToastrModule.forRoot()
})

5) Add toastr service to your desired component

import { ToastrService } from 'ngx-toastr';

@Component({...})
export class YourComponent {
constructor(private toastr: ToastrService) {}

showSuccess() {
this.toastr.success('Hello world!', 'Toastr fun!');
}
}

关于node.js - node_modules/ng2-toastr/src/toast-container.component.d.ts(1,48) : TS2305-/node_modules/@angular/core/core"' has no exported member 中的错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52043566/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com