How can I make the same functionality available both to config functions and controllers? I've run into this problem twice:

1. A service which is a collection of utility functions specific to my app. But services are not available to `app.config` functions.
2. Using ui-router, states and routes are configured in an `app.config` function but I would like for the same data to be available in controllers so that I can dynamically generate menus.

I could solve both situations by putting the functions or route data in the global `window` scope outside of angular, but it seems like there ought to be a better way. Something like how ui-router defines `$state` and `$stateProvider` except I want them to be the same.