AngularJS injection error in a resolve

I’m trying to get user profile metadata into a resolve as a promise which is then used by another promise get information based on a value in the user profile.

    $routeProvider.when('/wapmap', {
        templateUrl:  'wap_tools/wap_map.html',
        controller: 'wapMapClr',
        resolve: {
            mapres: function(profilePromise, service2) {
                profilePromise.then(function(profile) {
                    var viewerId = profile.app_metadata.viewers[1].viewerId;
                     return service2.getPromise(viewerId)
                     .then(function(response2) {    
                       hasPhotos = response2.vwrSettings[0].photos;
        requiresLogin: true

This throws the following error:

        at angular.min.js:6
        at angular.min.js:43
        at Object.d [as get] (angular.min.js:40)
        at angular.min.js:43
        at d (angular.min.js:40)
        at e (angular.min.js:41)
        at Object.invoke (angular.min.js:41)
        at angular-route.min.js:10
        at Object.q [as forEach] (angular.min.js:8)
        at angular-route.min.js:10 

So this looks like an injection error – how do I get the profilePromise data into the resolve?

Source: AngularJS