Hello All,
In last two post, we discussed about DI, various types available in AngularJS and some insights around it. It is going to be another post on DI itself but here we’ll talk about annotations.I would recommend to go through last two posts before going further.
- Dependency Injection (DI) in {{AngularJS}} – Part 16
- Dependency Injection (DI) in {{AngularJS}} Contd.– Part 17
Note – This post is a part of series of posts on AngularJS and it is 18th one. Click here to view all the post. Apart from that you can also use the navigation links for next and previous post in each post at the bottom to check all.
In our previous posts, we have seen that services are passed as a parameter with same name which was used defining like Circle and this is crucial because Angular internally locate the services using the name itself. So if the name does not match then dependencies won’t be resolved. As the name should be same so minifying the script would break the application which cannot be accepted. So let’s first see that the number of options provided by AngularJS.
So as we have seen, we have three ways to inject the dependencies. Lets discuss one by one