Pass invisible or hidden parameters using routerLink Angular

后端 未结 7 502
清酒与你
清酒与你 2020-12-03 10:48

I have router link like below:

I want t

7条回答
  •  我在风中等你
    2020-12-03 11:05

    Use state to pass hidden parameters and history to read 'em.

    First component:

    this.router.navigate(
          [`/dashboard/roles/${id}`],
          { state: { navSettings: navSettings } });
    

    Second component:

    public ngOnInit(): void {
        const id = this.activatedRoute.snapshot.params.id;
        this.initNavSettings(history.state.navSettings);
    }
    

提交回复
热议问题