import { Directive,ElementRef } from '@angular/core';
@Directive({
selector: '[appLogType]'
})
export class LogTypeDirective {
tyep:string=''
constructor(private eleRef:ElementRef) {
this.eleRef.nativeElement.innerHTML= this.tyep;
}
getType(HOST_ELEMENT_ROUTER_LINK){ // this.router.url; (router:Router)
// operation here
}
}
所以这是我创建的指令代码并且想要一种方法来从主机元素获取指令中路由器的 url