如何在延迟加载的模块中使用ngx-advanced-searchbox?

时间:2019-06-14 06:28:54

标签: javascript angular

我已经在主模块中成功实现了ngx-advanced-searchbox。 但是我无法在延迟加载的模块中使用它。

我遇到以下错误-

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:3198)
    at _createClass (core.js:23172)
.
.
.

1 个答案:

答案 0 :(得分:0)

您只能在应用程序的一个模块中使用BrowserModule,通常只能在app.module.ts中使用。如果您有多个模块,则必须在所有其他模块中导入CommonModule而不是BrowserModule。

编辑

您可以从app.module中的导入中删除BrowserModule,并依靠ngx-advanced-searchbox为您导入。 Here is a similar question