Angular UI-Router Repetitive templateProvider Using $rootScope I am developing an application that has different configurable versions - "a1" and "a2". The version name is initially being set from the database as "a1" in the $rootScope.

I reference the version name in every templateProvider in UI-Router, which ends up being over 30 times:

.state('app.auto.public.inventory.list', {
    url: '/',
    views: {
        'auto-one@app.auto': {
            templateProvider: ['$rootScope', '$templateCache', function($rootScope, $templateCache) {
            return $templateCache.get($rootScope.autoVersion + '/html/inventory/list/index.html');
        }],
        controller: 'InventoryList'
        }
    }
})


There must be a better way to access the value of "a1", instead of referencing $rootScope.autoVersion so many times?
A better solution is to resolve the data in a parent route, then inject the resolved data ("identityResolve") from a service ("identity") into each child instance.

.state('app.auto', {
    abstract: true,
    url: '',
    resolve: {
        identityResolve: ['identity', function(identity) {
            return identity.initialize().$promise;
        }]
    }
})


Which then is used like this

.state('app.auto.public.inventory.list', {
    url: '/',
    views: {
        'auto-one@app.auto': {
            templateProvider: ['$templateCache', 'identityResolve', function($templateCache, identityResolve) {
                return $templateCache.get(identityResolve.version + '/html/inventory/list/index.html');
        }],
        controller: 'InventoryList'
    }
});