20 lines
401 B
TypeScript
20 lines
401 B
TypeScript
import { Directive, HostListener, Input } from '@angular/core';
|
|
import { NavEngine } from './nav-engine.service';
|
|
|
|
@Directive({
|
|
selector: '[aioNavLink]'
|
|
})
|
|
export class NavLinkDirective {
|
|
|
|
@Input()
|
|
aioNavLink: string;
|
|
|
|
constructor(private navEngine: NavEngine) { }
|
|
|
|
@HostListener('click', ['$event'])
|
|
onClick($event) {
|
|
this.navEngine.navigate(this.aioNavLink);
|
|
return false;
|
|
}
|
|
}
|