DEPENDENCY INJECTION (NESTJS - TYPESCRIPT) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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 Answers
+ 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 Edmundo Rodríguez López Serra
Daniel Edmundo Rodríguez López Serra - avatar
25th Mar 2022, 1:52 PM
👑 Tchybooxuur!
👑 Tchybooxuur! - avatar