2017-03-01 78 views
0

我的應用程序使用如何編寫測試用例激活路由參數angular2

我試圖寫測試用例

它會有助於全面,如果有人介紹如何編寫測試用例激活 路線angular2框架參數

這裏是我得到的ID從URL

constructor(
    private router: Router, 
    private route: ActivatedRoute, 
    private authService: AuthService) { 

    this.sub = this.route.params.subscribe(params => { 
     this.iId = params['id']; // (+) converts string 'id' to a number 
    }); 
    } 
+0

[測試組件,依賴於路由參數]的可能重複(https://stackoverflow.com/questions/42385851/testing-a-component-which-depends-on-a-route-param) – jonrsharpe

回答

相關問題