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.
|
|
|
|
|
|
|
\begin{figure}[H]
|
|
|
|
\begin{lstlisting}[language=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}
|