angular-ui / ui-router

The de-facto solution to flexible routing with nested views in AngularJS
http://ui-router.github.io/
MIT License
13.56k stars 3.01k forks source link

Skeleton view in state declaration? #3723

Closed scipper closed 4 years ago

scipper commented 5 years ago

My version of UI-Router is: 1.0.16

Feature Request

I think, it would be nice to have a feature to display a skeleton template for a target state. This would be useful in cases, where resolves might take some time, as the state, better to say the defined views, are rendered after all resolves finished, of course.

The state definition for this feature could look like this:

$stateProvider
  .state("management", {
    url: "/management",
    views: {
      "management-view": {
        component: "management"
      }
    },
    previews: {    // <-- something like this?
      "management-view": {
        template: "skeleton.html"
      }
    }
    params: {
      id: {
       type: "string",
         value: ""
       }
    },
    resolve: {
      mightyResolve: () => {}
    }
});

The idea is, that the skeleton.html is rendered onBefore to show the user, that the transition has begun. If something failes (transition rejected) rerender the last state, demanding the previous resolves.

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

This does not mean that the issue is invalid. Valid issues may be reopened.

Thank you for your contributions.