Skip to content

Commit 03701c1

Browse files
author
huadong zuo
authored
Merge pull request #389 from kenlig/patch-1
fix(fundamentals.md):delete outdate sentences
2 parents 6355de9 + 5bc4d42 commit 03701c1

File tree

1 file changed

+0
-4
lines changed

1 file changed

+0
-4
lines changed

10/fundamentals.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
11
## 自定义提供者
22

3-
!!!待翻译
4-
53
在前面几章中,我们讨论了依赖注入(`DI`)的各个方面,以及如何在 `Nest` 中使用它。其中一个例子是基于[构造函数](https://docs.nestjs.com/providers#dependency-injection)的依赖注入,用于将实例(通常是服务提供者)注入到类中。当您了解到依赖注入是以一种基本的方式构建到 `Nest` 内核中时,您不会感到惊讶。到目前为止,我们只探索了一个主要模式。随着应用程序变得越来越复杂,您可能需要利用 `DI` 系统的所有特性,因此让我们更详细地研究它们。
64

75
### 依赖注入
86

9-
!!!待翻译
10-
117
依赖注入是一种控制反转(`IoC`)技术,您可以将依赖的实例化委派给 `IoC` 容器(在我们的示例中为 `NestJS` 运行时系统),而不是必须在自己的代码中执行。 让我们从[“提供者”](providers.md)一章中检查此示例中发生的情况。
128

139
首先,我们定义一个提供者。`@Injectable()`装饰器将 `CatsService` 类标记为提供者。

0 commit comments

Comments
 (0)