Query params

Sometimes, however, you want to share some parameters across many activated routes, and that's what query params are for. For instance, given this URL /inbox/33?token=23756, we can access token in any component:

class ConversationCmp {
  constructor(r: ActivateRoute) {
    r.queryParams.forEach((p) => {
      const token = p['token']
    });
  }
}

Since query parameters are not scoped, they should not be used to store route-specific information.

The fragment (for example, /inbox/33#fragment) is similar to query params:

class ConversationCmp {
  constructor(r: ActivatedRoute) {
    r.fragment.forEach((f:string) => {

    });
  }
}
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.188.91.44