Skip to content
Cyan's Blog
Main Navigation
前端
后端
数据库
我的积累
更多
Git
VSCode配置及插件
脚本
手写
快捷键
GitHub
Appearance
GitHub
Menu
Return to top
On this page
Table of Contents for current page
NestJS
有两个 module,一个是 AModule, 一个是 BModule, 如果想在 a.controler.ts 中使用 b.service.ts 中的方法,可以这样做:
在 a.module.ts 的 providers 数组中添加 BService
在 a.module.ts 的 imports 数组中添加 BModule, 同时在 BModule 的 exports 数组中添加 BService
给 a.module.ts 的添加 @Global() 装饰器, 同时在 BModule 的 exports 数组中添加 BService