What is the use of @inject()?



What is the use of @inject()?..

Answer / Veerander Kumar Yadav

@Inject() is a decorator in Angular 2 that can be used instead of the constructor injection syntax to inject dependencies. It is useful when you need to override the default dependency resolution for a specific class, or when working with third-party libraries that do not support constructor injection.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More AngularJS Interview Questions

Which framework is best for front end?

1 Answers  


How to bypass angular xss protection?

1 Answers  


What are the different types of directive?

1 Answers  


What is the factory method in angular 2?

1 Answers  


What is a service? How will you create a custom service?

1 Answers  


Is typescript an oop?

1 Answers  


What is routing in angular?

1 Answers  


What is lazy loading in angular 2?

1 Answers  


What are factory method in angularjs?

1 Answers  


What is single page application?

1 Answers  


What is difference between $interval and window. setInterval in AngularJS?

1 Answers  


Is angular 2 mobile oriented?

1 Answers  


Categories