After an update to alpha 37, I run into this error.
The scenario is as follow : I navigate to /my/sub/path. My app subscribed to the router, so that on each location change it checks that user credentials are still valid. In this case, I am redirected to /login. Upon sucessfull login, I am redirected to /my/sub/path, and this is where the following exception is thrown:
EXCEPTION: Error during instantiation of function (_elementRef, _loader, _parentRouter, nameAttr) {!. in [null]
EXCEPTION: Error during instantiation of function (_elementRef, _loader, _parentRouter, nameAttr) {!. in [null]
execute.$__super.logError @ angular2.js:21280
execute.$__super.logGroup @ angular2.js:21291
execute.ExceptionHandler.call @ angular2.js:22054
(anonymous function) @ angular2.js:11840
execute.$__5._onError @ angular2.js:9100
execute.$__5._createInnerZone.errorHandling.onError @ angular2.js:9020
run @ zone.js?v=0.0.0:116
execute.$__5._createInnerZone.zone.fork.fork.$run @ angular2.js:9041
zoneBoundFn @ zone.js?v=0.0.0:86
ORIGINAL EXCEPTION: Cannot reuse an outlet that does not contain a component.
execute.$__super.logError @ angular2.js:21280
execute.ExceptionHandler.call @ angular2.js:22063
(anonymous function) @ angular2.js:11840
execute.$__5._onError @ angular2.js:9100
execute.$__5._createInnerZone.errorHandling.onError @ angular2.js:9020
run @ zone.js?v=0.0.0:116
execute.$__5._createInnerZone.zone.fork.fork.$run @ angular2.js:9041
zoneBoundFn @ zone.js?v=0.0.0:86
ORIGINAL STACKTRACE:
execute.$__super.logError @ angular2.js:21280
execute.ExceptionHandler.call @ angular2.js:22066
(anonymous function) @ angular2.js:11840
execute.$__5._onError @ angular2.js:9100
execute.$__5._createInnerZone.errorHandling.onError @ angular2.js:9020
run @ zone.js?v=0.0.0:116
execute.$__5._createInnerZone.zone.fork.fork.$run @ angular2.js:9041
zoneBoundFn @ zone.js?v=0.0.0:86
Error: Cannot reuse an outlet that does not contain a component.
at new BaseException (angular2.js:4688)
at execute.RouterOutlet.reuse (router.js:5610)
at RootRouter.execute.hostComponent.commit (router.js:4935)
at RootRouter.execute.hostComponent.commit (router.js:5055)
at RootRouter.execute.hostComponent.registerPrimaryOutlet (router.js:4779)
at new execute.RouterOutlet.activate.$__4 (router.js:5589)
at execute.reflect.factory (angular2.js:12574)
at Injector.execute._proto._instantiate (angular2.js:6042)
at Injector.execute._proto._new (angular2.js:5973)
at InjectorInlineStrategy.execute.protoStrategy.instantiateBinding (angular2.js:5762)
It seems the instruction for "/my" path has the reuse field set to true, while it hasn't instanciated its component yet, probably because the redirect has been triggered before.
If I introduce a canReuse() method returning false in the /my component, this exception is not thrown. But as this component is just a container defining child routes and displaying some tabs, it should probably be reused.
After an update to alpha 37, I run into this error.
The scenario is as follow : I navigate to /my/sub/path. My app subscribed to the router, so that on each location change it checks that user credentials are still valid. In this case, I am redirected to /login. Upon sucessfull login, I am redirected to /my/sub/path, and this is where the following exception is thrown:
It seems the instruction for "/my" path has the
reusefield set to true, while it hasn't instanciated its component yet, probably because the redirect has been triggered before.If I introduce a
canReuse()method returning false in the /my component, this exception is not thrown. But as this component is just a container defining child routes and displaying some tabs, it should probably be reused.