Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Child state with blank URL leading to 404 warning on Karma-Jasmine tests #1430

Closed
igorauad opened this issue Oct 7, 2014 · 1 comment
Closed

Comments

@igorauad
Copy link

igorauad commented Oct 7, 2014

I have the following $stateProvider configuration, in which I use an abstract state main.profile resolving a resource that its child states (e.g. main.profile.view) inherit and use. I've noticed that, when running Jasmine unit tests on Karma, due to the fact the url: '' on main.profile.view state, I see a series of 404 warnings, as copied below:

.state('main.profile', {
            abstract: true,
            url: '/:username',
            resolve: {
                usersResource: 'Users',
                user: function(usersResource, $stateParams){
                    var username = $stateParams.username;
                    return usersResource.get({username: username}).$promise;
                }
            },
            controller: 'ProfileViewCtrl',
            templateUrl: 'public/modules/pro/views/profileContainer.client.view.html'           
        })      
        .state('main.profile.view', {
            url: '',
            templateUrl: 'public/modules/pro/views/view.client.view.html',
            onEnter: function(user){
                this.title = user.displayName;
            }       
        })
        .state('main.profile.work', {
            url: '/work',
            templateUrl: 'public/modules/pro/views/portfolio.client.view.html',
            onEnter: function(user) {
                this.title = 'Porfólio de ' + user.displayName;
            }
        })

404 warnings:

WARN [web-server]: 404: /public/modules/main/views/container.client.view.html
WARN [web-server]: 404: /public/modules/pro/views/profileContainer.client.view.html
WARN [web-server]: 404: /public/modules/pro/views/view.client.view.html
WARN [web-server]: 404: /users/context.html
WARN [web-server]: 404: /public/modules/core/views/404.client.view.html
WARN [web-server]: 404: /public/modules/core/views/404.client.view.html
WARN [web-server]: 404: /public/modules/core/views/404.client.view.html

The last three 404 warnings are due to an 404 interceptor configured on $httpProvider.

Did anybody have a similar problem and managed to solve?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants