2017-03-01 79 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

回答

相关问题