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

Templates don't load when 'resolve' is present #14

Open
techguydave opened this issue Oct 7, 2014 · 4 comments
Open

Templates don't load when 'resolve' is present #14

techguydave opened this issue Oct 7, 2014 · 4 comments

Comments

@techguydave
Copy link

I have a few ui-router states that use promises inside of resolves to wait on an API.

.state('videosDetails', {
  url: '..',
  templateUrl: '...',
  resolve: {
    videoPromise: function(Restangular, $stateParams){
      ...
    }
  },
  controller: '...'
})

With the userapp module initiated in the run() block, though, any state with a resolve doesn't load properly. I can tell that the promises are being hit, because my API server responds to the requests. The template doesn't seem to load, though.

I thought it was just the promises causing an issue, but even using empty resolves like your documentation states creates the same issue. When commenting out the user.init({ appId: '...' }); part (yet still leaving the UserApp module declaration), everything works again.

I get no errors in the console.

@timothyej
Copy link
Member

Can you see if any API calls are made to UserApp? And what version of Angular and ui-router are you using?

@techguydave
Copy link
Author

It looks like an API call is not made to UserApp.

Angular 1.2.23
ui-router 0.2.10

@techguydave
Copy link
Author

For now I'm just using promises in the controllers as a workaround, but I'd really like to use resolves for some of the pages. Let me know if you need me to help test something out.

@joerozek
Copy link

I ran into this issues as well. Here is a PR #15 that should fix the issue.

Alternatively a workaround is to also define public right on the state.

.state('mystate', {
    url: '/start',
    templateUrl: 'templates/my-start.html',
    controller: 'StateCtrl',
    data: {
      public: true
    },
    public: true
});

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

3 participants