When it comes to reading and understanding what you're asking, I believe utilizing a function within your .config()
can be helpful. Inside that function, you can inject the necessary services.
Here's an example using a function with ui.router
to give you an idea of how to implement it:
app = angular.module('myApp', [])
.config(function ($stateProvider) {
var doSomething = function ($http, $cookies, myService) {
// Implement your logic here
}
$stateProvider
.state('myState', {
url: '/',
resolve: { doSomething: doSomething },// You can use your function here
templateUrl: "views/login.html",
controller: 'LoginController'
});
});
Alternatively, you can also utilize Providers
to inject into your .config()
for usage.