You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
731 B
43 lines
731 B
2 years ago
|
|
||
|
\begin{figure}[H]
|
||
|
\begin{lstlisting}[style=JavaScript]
|
||
|
export abstract class IChildService {
|
||
|
// ...
|
||
|
}
|
||
|
|
||
|
@Injectable(IChildService)
|
||
|
export class ChildService implements IChildService {
|
||
|
// ...
|
||
|
}
|
||
|
|
||
|
@Injectable()
|
||
|
export class ParentService {
|
||
|
private childService: IChildService;
|
||
|
|
||
|
constructor(
|
||
|
childService: IChildService
|
||
|
) {
|
||
|
this.childService = IChildService;
|
||
|
}
|
||
|
|
||
|
// ...
|
||
|
}
|
||
|
|
||
|
@Module({
|
||
|
providers: [
|
||
|
ChildService,
|
||
|
ParentService
|
||
|
],
|
||
|
exports: [
|
||
|
ParentService
|
||
|
]
|
||
|
})
|
||
|
export class ParentModule {}
|
||
|
\end{lstlisting}
|
||
|
|
||
|
\centering
|
||
|
\includegraphics{nestjs1}
|
||
|
\caption{Exemple d'injection de dépendances avec NestJS}
|
||
|
\label{nestjs1}
|
||
|
\end{figure}
|