typescript - Extending routerLink in angular 2? -


how can extend [routerlink] directive angular router v3 can wrap custom functionality myself? i've taken @ routerlinkwithhref directive , appears want extend, produced this:

extendedrouterlinkdirective

import {directive, input} '@angular/core'; import {routerlinkwithhref} "@angular/router"; import {model} "../classes/model.class";  @directive({     selector: 'a[extendedrouterlink]' }) export class extendedrouterlinkdirective extends routerlinkwithhref {     @input('extendedrouterlink') model : model;      // future custom logic } 

and try , use so:

<a [extendedrouterlink]="model"> 

and include in directives array of component:

... directives: [router_directives, extendedrouterlinkdirective], ... 

yet, following runtime error:

"template parse errors: can't bind 'extendedrouterlink' since isn't known native property"

if remove extends routerlinkwithhref directive, works without errors. doing wrong?


Comments

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -