鍍金池/ 問答/HTML5  HTML/ angular2 routerLink path參數(shù)配置 函數(shù)運行兩次問題

angular2 routerLink path參數(shù)配置 函數(shù)運行兩次問題

鏈接地址https://stackoverflow.com/que...

<a [routerLink]="['/XXX', nextInfo()]"></a>

ts

numtotal=1;
nextInfo(){
    console.log(numtotal);
    numtotal++;
}

運行結(jié)果是 nexInfo()在組件運行的時候運行了 兩次

回答
編輯回答
愚念

原因 結(jié)果 請看頭部鏈接

2017年1月4日 18:24