+ 5

DEPENDENCY INJECTION (NESTJS - TYPESCRIPT)

https://www.sololearn.com/post/1571828/?ref=app How would you explain dependency injection to a non-programmer or newbie developer? // DEPENDENCY INJECTION // NestJS - TypeScript /* How would you explain dependency injection to a non-programmer? */ import {Component} from '@angular/core'; import {CarService} from './car.service'; import {Car} from './car'; ... export class AppComponent { cars : Car[]; constructor(private carService : CarService) { this.cars = this.carService.getCars(); } }

12th Mar 2022, 1:01 PM
👑 Tchybooxuur!
👑 Tchybooxuur! - avatar
2 Réponses
+ 1
It's a module/component injected in the constructor of class to be used by this and this is a mechanism that let you abstract external functionality from classes where they are used
25th Mar 2022, 1:42 PM
Daniel Rodriguez
Daniel Rodriguez - avatar
25th Mar 2022, 1:52 PM
👑 Tchybooxuur!
👑 Tchybooxuur! - avatar