Impact of Gen-AI on IT Jobs - Growth Mindset Show
x
C# Corner
Tech
News
Videos
Forums
Jobs
Books
Events
More
Interviews
Live
Learn
Training
Career
Members
Blogs
Challenges
Certification
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Refer
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
.NET
ADO.NET
Android
ASP.NET
C#
Databases & DBA
Design Patterns & Practices
iOS
Java
OOP/OOD
SharePoint
Software Testing
Web Development
WPF
View All
4
Reply
what is injector in Angular Js?
Bhuvanesh Mohankumar
9y
1.4k
0
Reply
Delete Row
Delete Column
Insert Link
×
Insert
Cancel
Embed YouTube Video
×
Width (%)
Height (%)
Insert
Cancel
Table Options
×
Rows
Columns
First row as header
Create Table
Insert Image
×
Selected file:
Alignment
Left
Center
Right
Select an image from your device to upload
Upload to Server
Cancel
Submit
AngularJS injector is key to making dependency injection work in Angular. The angular.injector() function is used to create injector object for dependency injection and services retrieving. Using injector, you can register factory, service and directive modules methods.Syntaxangular.injector(modules, [strictDi]);
sushil kumar
8y
0
function MyCtrl($scope, $injector) {$scope.doSomething = function(someService) {var service = $injector.get(someService) // someService contains the name of a serviceservice.value += 10 }
sreedhar puligundla
8y
0
There is one injector per Angular application. Normally you don't need to interact with it directly. The injector is key to making dependency injection work in Angular.Module methods such as factory, service, directive, etc. register these items with the injector. When you inject something (e.g., a service into a controller), the injector will lookup and then instantiate the service (if it wasn't instantiated already -- if it was, it will return the already-instantiated object).If for some reason you really needed to dynamically inject a service into, say, a controller, see http://stackoverflow.com/a/14418384/215945 for an example of how to do that. See also http://stackoverflow.com/a/14743553/215945
sreedhar puligundla
8y
0
An injector is a service locator. It is used to retrieve object instances as defined by provider, instantiate types, invoke methods and load modules.
Bhuvanesh Mohankumar
9y
0
What makes AngularJS better ?
what is string interpolation in Angular.js ?
Message