+ 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(); } }
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
+ 1
Daniel Edmundo Rodríguez López Serra
Thanks a lot brof.