首页 > 解决方案 > 我将 Angular 5 更新到 8,但我在 toastr 上出现错误

问题描述

我将我的角度 5 更新为 8

当我启动(ng 服务器)时,控制台上出现此错误

Uncaught TypeError: core_1.style is not a function
at Object../node_modules/ng2-toastr/src/toast-container.component.js (toast-container.component.js:118)
at __webpack_require__ (bootstrap:84)
at Object../node_modules/ng2-toastr/src/toast-manager.js (toast-manager.js:4)
at __webpack_require__ (bootstrap:84)
at Object../node_modules/ng2-toastr/ng2-toastr.js (ng2-toastr.js:5)
at __webpack_require__ (bootstrap:84)
at Module../src/app/app.module.ts (app.error-handle.ts:6)
at __webpack_require__ (bootstrap:84)
at Module../src/main.ts (main.ts:1)
at __webpack_require__ (bootstrap:84)
at Object.0 (main.ts:12)
at __webpack_require__ (bootstrap:84)
at checkDeferredModules (bootstrap:45)
at Array.webpackJsonpCallback [as push] (bootstrap:32)
at main.js:1

我已经做了这个命令:

npm i ng2
npm i ng2-toastr

角度版本

在此处输入图像描述

标签: angular

解决方案


它可能正在使用@ViewChildor @ContentChild,这些在 Angular 8 中发生了重大变化。由于该软件包已经 2 年没有更新,您可能应该寻找另一个库。


推荐阅读