feat(router): routerLink add tabindex attribute (#13094)

Fixes #10895
This commit is contained in:
Dzmitry Shylovich
2016-12-10 02:38:50 +03:00
committed by Victor Berchet
parent 90c223591f
commit a006c1418a
3 changed files with 12 additions and 5 deletions

View File

@ -7,7 +7,7 @@
*/
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 {NavigationEnd, Router} from '../router';
@ -89,7 +89,13 @@ export class RouterLink {
@Input() replaceUrl: boolean;
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()
set routerLink(data: any[]|string) {