1

can you help me with same problem Angular UI Router, route resolve breaking refresh button

i have factory:

factory('AppearanceService', function ($resource, $rootScope) {
        return $resource($rootScope.urlAppearanceBackend+'/api/v1/appearance', {}, {
            'query': {method: 'GET', isArray: false},
            'update': {method:'PUT'}
        });
})

route:

.state('settings', {
                url: '/settings',
                views: {
                    header: {
                        templateUrl: 'views/header.html',
                        controller: 'IntegrationCtrl'
                    },
                    content: {
                        templateUrl: 'views/settings.html',
                        controller: 'SettingsCtrl'
                    },
                    footer: {
                        templateUrl: 'views/footer.html'
                    }
                },
                resolve: {
                    'MySettings':function(AppearanceService, $rootScope) {
                        $rootScope.currentSettingsForm = AppearanceService.query();
                        return $rootScope.currentSettingsForm.$promise;
                    }
                }
            })

controller:

angular.module('app').controller('SettingsCtrl', function ($scope, MySettings) {    
    $scope.settings = MySettings;
});

When i go to ui-href its normally, but reload page with browser button - error:

> GET http://localhost:8080/undefined/api/v1/appearance 404 (Not Found)
> app.js:221 Object {data: "Not found↵", status: 404, headers: function,
> config: Object, statusText: "Not Found"}
Community
  • 1
  • 1
a.chugunov
  • 174
  • 2
  • 9

0 Answers0