更新时间:2023-11-22 17:23:22
只需创建一个SharedModule
,然后将ClickOutsideModule
添加到它的imports
和exports
数组中.像这样:
Just create a SharedModule
, add the ClickOutsideModule
to the imports
and exports
array of it. Something like this:
import { NgModule } from '@angular/core';
import { ClickOutsideModule } from "ng-click-outside";
@NgModule({
imports: [
ClickOutsideModule,
...
],
exports: [
ClickOutsideModule,
...
],
})
export class SharedModule {}
,然后在要访问ClickOutsideModule
模块的任何位置导入SharedModule
.举例来说,如果您希望在AppModule中使用它,请按以下步骤操作:
And then import the SharedModule
whereever you want to have access to the ClickOutsideModule
module. Say for eg, if you want it in the AppModule, here's how you'll do it:
...
import { SharedModule } from './shared/shared.module';
@NgModule({
...,
imports: [
SharedModule,
...
],
...
})
export class AppModule { }
您可以对PopupModule
做同样的事情:
You can do the same for PopupModule
:
...
import { SharedModule } from './shared/shared.module';
@NgModule({
...,
imports: [
SharedModule,
...
],
...
})
export class PopupModule { }