Angular 2 reload route on param change

后端 未结 13 1102
小鲜肉
小鲜肉 2020-12-07 13:15

I am currently writing my first Angular 2 Application. I have an OverviewComponent which has the following simple template:

13条回答
  •  [愿得一人]
    2020-12-07 13:47

    As per the first final release, this is resolved.

    Just pay much attention to correctly reset the state of the component when the parameter changes

    this.route.params.subscribe(params => {
        this.param = params['yourParam'];
        this.initialiseState(); // reset and set based on new parameter this time
    });
    

提交回复
热议问题