所以,我得到的是以下内容:
core.js:1673 ERROR Error: Uncaught (in promise): Error: BrowserModule has already been loaded.
If you need access to common directives such as NgIf and NgFor from a lazy loaded module, import CommonModule instead.
Error: BrowserModule has already been loaded. If you need access to common directives such as NgIf and NgFor from a lazy loaded module, import CommonModule instead.
at new BrowserModule (platform-browser.js:1965)
at _createClass (core.js:8414)
at _createProviderInstance (core.js:8386)
at initNgModule (core.js:8319)
at new NgModuleRef_ (core.js:9045)
at createNgModuleRef (core.js:9034)
at Object.debugCreateNgModuleRef [as createNgModuleRef] (core.js:10859)
at NgModuleFactory_.push../node_modules/@angular/core/fesm5/core.js.NgModuleFactory_.create (core.js:11576)
at MapSubscriber.project (router.js:3254)
at MapSubscriber.push../node_modules/rxjs/_esm5/internal/operators/map.js.MapSubscriber._next (map.js:35)
at resolvePromise (zone.js:814)
at resolvePromise (zone.js:771)
at zone.js:873
at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:421)
at Object.onInvokeTask (core.js:3811)
at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:420)
at Zone.push../node_modules/zone.js/dist/zone.js.Zone.runTask (zone.js:188)
at drainMicroTaskQueue (zone.js:595)
at ZoneTask.push../node_modules/zone.js/dist/zone.js.ZoneTask.invokeTask [as invoke] (zone.js:500)
at invokeTask (zone.js:1540)
我已经从这两篇文章中寻求帮助:
https://stackoverflow.com/questions/52860517/getting-browsermodule-already-loaded-despite-not-importing-it-in-lazy-loaded-mod
AND
https://stackoverflow.com/questions/39286667/browsermodule-has-already-been-loaded-error
我从子组件... module.ts文件中删除了BrowserAnimationsModule和BrowserModule的所有实例,因为前者有14个实例,后者有4个实例。
这14个实例是实际的子文件夹,其中将... module.ts文件导入到app.module.ts中。
我已经尝试过,当我在主页上单击“登录”时,上面出现了该错误。
当我停止该过程时,它首先在1953行附近在platform-browser.js中失败
/**
* Exports required infrastructure for all Angular apps.
* Included by defaults in all Angular apps created with the CLI
* `new` command.
* Re-exports `CommonModule` and `ApplicationModule`, making their
* exports and providers available to all apps.
*
*
*/
var BrowserModule = /** @class */ (function () {
function BrowserModule(parentModule) {
if (parentModule) {
throw new Error("BrowserModule has already been loaded. If you need access to common directives such as NgIf and NgFor from a lazy loaded module, import CommonModule instead.");
}
}
BrowserModule_1 = BrowserModule;
在NgZone函数中第3778行附近的core.js中,这是麻烦开始的地方
NgZone.prototype.runOutsideAngular = function (fn) {
return this._outer.run(fn);
};
return NgZone;
任何帮助将不胜感激