cleanup(router): add @internal to constructors where needed

This commit is contained in:
vsavkin 2016-06-02 15:18:34 -07:00
parent ab958598d7
commit f04b6978fb
4 changed files with 27 additions and 4 deletions

View File

@ -40,6 +40,9 @@ export class RouterLink {
// the url displayed on the anchor element. // the url displayed on the anchor element.
@HostBinding() href: string; @HostBinding() href: string;
/**
* @internal
*/
constructor(private router: Router, private route: ActivatedRoute) {} constructor(private router: Router, private route: ActivatedRoute) {}
@Input() @Input()
@ -51,8 +54,7 @@ export class RouterLink {
} }
this.updateTargetUrlAndHref(); this.updateTargetUrlAndHref();
} }
@HostListener("click") @HostListener("click")
onClick(): boolean { onClick(): boolean {
// If no target, or if target is _self, prevent default browser behavior // If no target, or if target is _self, prevent default browser behavior

View File

@ -7,8 +7,11 @@ export class RouterOutlet {
private activated:ComponentRef<any>|null; private activated:ComponentRef<any>|null;
public outletMap:RouterOutletMap; public outletMap:RouterOutletMap;
/**
* @internal
*/
constructor(parentOutletMap:RouterOutletMap, private location:ViewContainerRef, constructor(parentOutletMap:RouterOutletMap, private location:ViewContainerRef,
@Attribute('name') name:string, public injector: Injector) { @Attribute('name') name:string) {
parentOutletMap.registerOutlet(name ? name : PRIMARY_OUTLET, this); parentOutletMap.registerOutlet(name ? name : PRIMARY_OUTLET, this);
} }
@ -28,7 +31,7 @@ export class RouterOutlet {
activate(factory: ComponentFactory<any>, providers: ResolvedReflectiveProvider[], activate(factory: ComponentFactory<any>, providers: ResolvedReflectiveProvider[],
outletMap: RouterOutletMap): void { outletMap: RouterOutletMap): void {
this.outletMap = outletMap; this.outletMap = outletMap;
let inj = ReflectiveInjector.fromResolvedProviders(providers, this.location.parentInjector); const inj = ReflectiveInjector.fromResolvedProviders(providers, this.location.parentInjector);
this.activated = this.location.createComponent(factory, this.location.length, inj, []); this.activated = this.location.createComponent(factory, this.location.length, inj, []);
} }
} }

View File

@ -23,6 +23,9 @@ import { Type, ComponentFactory } from '@angular/core';
* ``` * ```
*/ */
export class RouterState extends Tree<ActivatedRoute> { export class RouterState extends Tree<ActivatedRoute> {
/**
* @internal
*/
constructor(root: TreeNode<ActivatedRoute>, public queryParams: Observable<Params>, public fragment: Observable<string>, public snapshot: RouterStateSnapshot) { constructor(root: TreeNode<ActivatedRoute>, public queryParams: Observable<Params>, public fragment: Observable<string>, public snapshot: RouterStateSnapshot) {
super(root); super(root);
} }
@ -68,6 +71,9 @@ export class ActivatedRoute {
_futureSnapshot: ActivatedRouteSnapshot; _futureSnapshot: ActivatedRouteSnapshot;
snapshot: ActivatedRouteSnapshot; snapshot: ActivatedRouteSnapshot;
/**
* @internal
*/
constructor(public urlSegments: Observable<UrlSegment[]>, constructor(public urlSegments: Observable<UrlSegment[]>,
public params: Observable<Params>, public params: Observable<Params>,
public outlet: string, public outlet: string,
@ -103,6 +109,9 @@ export class ActivatedRouteSnapshot {
/** @internal **/ /** @internal **/
_lastUrlSegment: UrlSegment; _lastUrlSegment: UrlSegment;
/**
* @internal
*/
constructor(public urlSegments: UrlSegment[], constructor(public urlSegments: UrlSegment[],
public params: Params, public params: Params,
public outlet: string, public outlet: string,
@ -128,6 +137,9 @@ export class ActivatedRouteSnapshot {
* ``` * ```
*/ */
export class RouterStateSnapshot extends Tree<ActivatedRouteSnapshot> { export class RouterStateSnapshot extends Tree<ActivatedRouteSnapshot> {
/**
* @internal
*/
constructor(root: TreeNode<ActivatedRouteSnapshot>, public queryParams: Params, public fragment: string | null) { constructor(root: TreeNode<ActivatedRouteSnapshot>, public queryParams: Params, public fragment: string | null) {
super(root); super(root);
} }

View File

@ -10,12 +10,18 @@ export function createEmptyUrlTree() {
* A URL in the tree form. * A URL in the tree form.
*/ */
export class UrlTree extends Tree<UrlSegment> { export class UrlTree extends Tree<UrlSegment> {
/**
* @internal
*/
constructor(root: TreeNode<UrlSegment>, public queryParameters: {[key: string]: string}, public fragment: string | null) { constructor(root: TreeNode<UrlSegment>, public queryParameters: {[key: string]: string}, public fragment: string | null) {
super(root); super(root);
} }
} }
export class UrlSegment { export class UrlSegment {
/**
* @internal
*/
constructor(public path: string, public parameters: {[key: string]: string}, public outlet: string) {} constructor(public path: string, public parameters: {[key: string]: string}, public outlet: string) {}
toString() { toString() {