Firstly, soory for no plunker, I wasn't able to run ng2 there, but here's code
import {Component, provide, bootstrap} from 'angular2/angular2';
import {
RouteConfig,
ROUTER_DIRECTIVES,
ROUTER_PROVIDERS,
ROUTER_PRIMARY_COMPONENT
} from 'angular2/router';
@Component({
template:`Route11NODE`
})
export class Route11Node {}
@Component({
template: 'Route12NODE'
})
export class Route12 {}
@Component({
template:`Route1NODE`
})
export class Route1Node {}
@Component({
directives: [ROUTER_DIRECTIVES],
template: 'Route1 => <router-outlet></router-outlet>'
})
@RouteConfig([
{ path: '/route11', component: Route11Node, as: 'Route11Node' },
{ path: '/route12', component: Route12, as: 'Route12' }
])
export class Route1 {
}
@Component({
selector: 'app',
viewProviders: [],
directives: [ROUTER_DIRECTIVES],
template: `
<section class="sample-app-content">
<nav>
<a [router-link]="['/Route1Node']">Route1</a><br>
<a [router-link]="['/Route1/Route11Node']">Route11</a><br>
<a [router-link]="['/Route1/Route12']">Route12</a><br>
</nav>
<h2><router-outlet></router-outlet></h2>
</section>
`
})
@RouteConfig([
{ path: '/route1', component: Route1Node, as: 'Route1Node' },
{ path: '/route1/...', component: Route1, as: 'Route1' }
])
class App {}
bootstrap(App, [
ROUTER_PROVIDERS,
provide(ROUTER_PRIMARY_COMPONENT,{useValue:App})
]);
after recompile you cas see this in browser:
Now to simulate problem:
- double click on
Route11
- click on
Route1
- click on
Route11
and you will get: Cannot reuse an outlet that does not contain a component.. If you click on Route12 and then back to Route11, everything will work, but if you click to Route1 and then Route11 everytime you will get this error
Used @mgechev 's angular2-seed build with alpha42
Problem simulated in chrome, ie10, firefox, opera
Firstly, soory for no plunker, I wasn't able to run ng2 there, but here's code
after recompile you cas see this in browser:
Now to simulate problem:
Route11Route1Route11and you will get:
Cannot reuse an outlet that does not contain a component.. If you click onRoute12and then back toRoute11, everything will work, but if you click toRoute1and thenRoute11everytime you will get this errorUsed @mgechev 's angular2-seed build with
alpha42Problem simulated in chrome, ie10, firefox, opera