I am trying to use $routeProvider dependency inside my controller:
.controller('mainController', function($scope, $state, $routeProvider) {
But I am getting the error:
Error: [$injector:unpr] Unknown provider: $routeProviderProvider <- $routeProvider
How do I know what dependencies I can inject into any given controller?
There are two phases inside angular
app.configto write a code)app.run, after run cycle all other directives gets executed using compile cycle)Provider is nothing but service/factory but the most important thing is it can be accessible inside configuration phase.
Example
Suppose we have below provider
While inject it inside config you should always prefix it
ProviderlikeunicornLauncherProviderWhile using it inside controller you could use it as
unicornLauncherNote:
Still confuse then do refer this link