Angular 2获得路线参数

时间:2016-11-27 15:32:01

标签: angular angular2-routing

我如何以这种方式获得params:

mydomain.com/?token=MY_TOKEN&some=test

如何从网址tokensome获取角度2组件? 我试过了:

this.route.params
    .subscribe((params) => {
        this.token = params['token'];
        this.some = params['some'];
    });

1 个答案:

答案 0 :(得分:0)

这是您正在寻找的查询参数

this.route.queryParams
.subscribe((params) => {
    this.token = params['token'];
    this.some = params['some'];
});