I can't seem to extend RouterOutlet when using the new router in RC.1
Example:
import { Directive } from '@angular/core';
import { Router, ROUTER_DIRECTIVES, RouterOutlet } from '@angular/router';
@Directive({
selector: 'router-outlet'
})
export class RouterOutletDirective extends RouterOutlet {
}
The error:
@angular/router/index"' has no exported member 'RouterOutlet'.
Am i doing something wrong or is this broke with the new router in RC.1?
Updated:
import { Directive, Attribute, ViewContainerRef, DynamicComponentLoader } from '@angular/core';
import { Router, Routes, RouterOutletMap } from '@angular/router';
import { RouterOutlet } from '@angular/router/src/directives/router_outlet';
@Directive({
selector: 'router-outlet'
})
export class RouterOutletDirective extends RouterOutlet {
constructor(parentOutletMap: RouterOutletMap, _location: ViewContainerRef, name: string) {
super(parentOutletMap, _location, name);
console.log( parentOutletMap );
}
activate() {
console.log('Activate');
}
}
So it's now running but the RouterOutlet is underlined in red with type "any" is not a constructor function type and also the activate part doesn't work. Am i missing something?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…