rpocklin / angular-ui-view-spinner

A declarative way to display loading spinners in angular.js for ui-router resolves the way you want them to appear.
Other
24 stars 5 forks source link

change to child states don't show spinners #1

Open pdemilly opened 8 years ago

pdemilly commented 8 years ago

Let's say my index.html has a named view

<ui-loading-view name="main" root-state="wep"></ui-loading-view>

and I define my router with a a hierarchy of states. the spinner won't show when changing from wep.contacts state to wep.contacts.edit state.

$stateProvider.state ('wep', {
url: '/',
abstract: true,
resolve: {
}
})
.state ('wep.contacts', {
url: '/contacts',
views: {
'main@': {
template: '<h1>Contacts view</h1><button ui-sref=".edit">Edit</button>'
controller: 'wep.contacts.controller',
controllerAs: 'vm',
},
contactList: function ($timeout) {
$timeout (function () { return [], 5000 });
});
}).state ('wep.contacts.edit', {
url: '/edit',
views: {
'main@': {
template: '<h1>edit contact view</h1>'
controller: 'wep.contacts.edit.controller',
controllerAs: 'vm',
},
resolve: {
contact: function ($timeout) {
$timeout (function () { return { name: John Doe' }, 5000 });
});
rpocklin commented 8 years ago

I haven't run your code, but if you take a look at the example it does what you speak of.

http://rp.js.org/angular-ui-view-spinner/example/index.html#/two

If you click 'A' or 'B' from that route it will show a spinner and load a sub-route of #/two - is this what you are trying to achieve?

rpocklin commented 8 years ago

BTW there's too many syntax errors (missing commas, quotes) for me to make use of that example code you added.

pdemilly commented 8 years ago

sorry I didn't copy and paste just duck typed it to give an idea. Basically a child state redefines the same view of the parent and in between we should see the spinner and I don't

rpocklin commented 8 years ago

I'm looking into making this work for silbing without a base root state, which may fix this issue. PRs welcome, or even if you add a failing test to kickoff a PR that will be useful.