feat(angular1_router): allow component to bind to router

This commit is contained in:
Peter Bacon Darwin
2016-02-07 20:40:00 +00:00
committed by Igor Minar
parent c6036435f0
commit 0f22dce036
2 changed files with 66 additions and 17 deletions

View File

@ -156,10 +156,11 @@ function ngOutletDirective($animate, $q: ng.IQService, $router) {
this.controller.$$routeParams = instruction.params;
this.controller.$$template =
'<' + dashCase(componentName) + '></' + dashCase(componentName) + '>';
'<' + dashCase(componentName) + ' router="$$router"></' + dashCase(componentName) + '>';
this.controller.$$router = this.router.childRouter(instruction.componentType);
let newScope = scope.$new();
newScope.$$router = this.controller.$$router;
let clone = $transclude(newScope, clone => {
$animate.enter(clone, null, this.currentElement || element);