parent
90c223591f
commit
a006c1418a
@ -7,7 +7,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import {LocationStrategy} from '@angular/common';
|
import {LocationStrategy} from '@angular/common';
|
||||||
import {Directive, HostBinding, HostListener, Input, OnChanges, OnDestroy} from '@angular/core';
|
import {Attribute, Directive, ElementRef, HostBinding, HostListener, Input, OnChanges, OnDestroy, Renderer} from '@angular/core';
|
||||||
import {Subscription} from 'rxjs/Subscription';
|
import {Subscription} from 'rxjs/Subscription';
|
||||||
|
|
||||||
import {NavigationEnd, Router} from '../router';
|
import {NavigationEnd, Router} from '../router';
|
||||||
@ -89,7 +89,13 @@ export class RouterLink {
|
|||||||
@Input() replaceUrl: boolean;
|
@Input() replaceUrl: boolean;
|
||||||
private commands: any[] = [];
|
private commands: any[] = [];
|
||||||
|
|
||||||
constructor(private router: Router, private route: ActivatedRoute) {}
|
constructor(
|
||||||
|
private router: Router, private route: ActivatedRoute,
|
||||||
|
@Attribute('tabindex') tabIndex: string, renderer: Renderer, el: ElementRef) {
|
||||||
|
if (tabIndex == null) {
|
||||||
|
renderer.setElementAttribute(el.nativeElement, 'tabindex', '0');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Input()
|
@Input()
|
||||||
set routerLink(data: any[]|string) {
|
set routerLink(data: any[]|string) {
|
||||||
|
@ -1031,8 +1031,9 @@ describe('Integration', () => {
|
|||||||
advance(fixture);
|
advance(fixture);
|
||||||
expect(fixture.nativeElement).toHaveText('team 22 [ link, right: ]');
|
expect(fixture.nativeElement).toHaveText('team 22 [ link, right: ]');
|
||||||
|
|
||||||
const native = fixture.nativeElement.querySelector('button');
|
const button = fixture.nativeElement.querySelector('button');
|
||||||
native.click();
|
expect(button.getAttribute('tabindex')).toEqual('0');
|
||||||
|
button.click();
|
||||||
advance(fixture);
|
advance(fixture);
|
||||||
|
|
||||||
expect(fixture.nativeElement).toHaveText('team 33 [ simple, right: ]');
|
expect(fixture.nativeElement).toHaveText('team 33 [ simple, right: ]');
|
||||||
|
2
tools/public_api_guard/router/index.d.ts
vendored
2
tools/public_api_guard/router/index.d.ts
vendored
@ -249,7 +249,7 @@ export declare class RouterLink {
|
|||||||
routerLink: any[] | string;
|
routerLink: any[] | string;
|
||||||
skipLocationChange: boolean;
|
skipLocationChange: boolean;
|
||||||
urlTree: UrlTree;
|
urlTree: UrlTree;
|
||||||
constructor(router: Router, route: ActivatedRoute);
|
constructor(router: Router, route: ActivatedRoute, tabIndex: string, renderer: Renderer, el: ElementRef);
|
||||||
onClick(): boolean;
|
onClick(): boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user