What is a Dependency Injection? - LearnHowToCode SarkariResult.com Interview Questions and Answers LearnHowToCodeOnline
What is a Dependency Injection?

What is a Dependency Injection?

What is a Dependency Injection?

Dependency Injection gives us the ability to add functionalities across different components at runtime in an angular application.
What is a Dependency Injection?
We can create a service by importing Injectable library from our @angular/core.
import { 
   Injectable 
} from '@angular/core'; 

@Injectable () 
export class Service {  
   commonFunction(): string { 
      return "Hello world"; 
   } 
}
In angular application we need to give references inside the provider.
Provider in angular is a pre-defined object that gives instructions to the injector in our application on how to create those dependencies.
Most dependencies are services in angular hence angular uses DI to provide components the individual services they need for functionality.

About Mariano

I'm Ethan Mariano a software engineer by profession and reader/writter by passion.I have good understanding and knowledge of AngularJS, Database, javascript, web development, digital marketing and exploring other technologies related to Software development.

0 comments:

Featured post

Political Full Forms List

Acronym Full Form MLA Member of Legislative Assembly RSS Really Simple Syndication, Rashtriya Swayamsevak Sangh UNESCO United Nations E...

Powered by Blogger.