简体   繁体   English

如何修复 angular 11 中超出最大调用堆栈大小的错误?

[英]How to fix maximum call stack size exceeded error in angular 11?

I have 2 modules in angular 11我在 angular 11 中有 2 个模块

  1. CustomerModule客户模块
  2. AccountingModule会计模块

and declare some component as widget component in these modules that used in each other并在这些相互使用的模块中将一些组件声明为小部件组件

  1. CustomerModule -> CustomerBlockInfoWidget CustomerModule -> CustomerBlockInfoWidget
  2. AccountingModule -> AccountingBalanceWidget AccountingModule -> AccountingBalanceWidget

now want to use CustomerBlockInfoWidget in AccountingModule and AccountingBalanceWidget in CustomerModule现在想在 AccountingModule 中使用 CustomerBlockInfoWidget,在 CustomerModule 中使用 AccountingBalanceWidget

and finally, I have the infinity load and get Maximum call stack size exceeded error最后,我有无限负载并得到 Maximum call stack size exceeded 错误

now how I can use these widgets that fix the infinity load现在我如何使用这些修复无限负载的小部件

Maximum call stack size exceeded error is always a symptom of an infinite loop. Maximum call stack size exceeded错误始终是无限循环的症状。 The provided information doesn't point to a possible place in the code that triggers it.提供的信息并未指向代码中触发它的可能位置。

It might be a simple loop with no chance for an exit or a more complex scenario like Function A calls Function B which calls Function C which calls Function A and here it goes again. It might be a simple loop with no chance for an exit or a more complex scenario like Function A calls Function B which calls Function C which calls Function A and here it goes again.

If you have a call stack of the error, reading it should be enough to notice this infinite execution.如果您有错误的调用堆栈,阅读它应该足以注意到这种无限执行。

Please make sure that you did not add any components, directives, and pipes in the import array of modules.请确保您没有在模块的导入数组中添加任何组件、指令和管道。

NOTE笔记

You can add standalone components, directives, and pipes in the import array of the module.您可以在模块的导入数组中添加独立的组件、指令和管道。

In may case, I accidentally included my component to import instead of export.在可能的情况下,我不小心包含了我的组件以导入而不是导出。 the commented part was causing the problem.评论部分导致了问题。

enter image description here在此处输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM