Search code examples
angularangular-router

Second parameter of Router.navigate() in Angular v4?


I am having trouble understanding Router.navigate(). Here are my questions.

  1. What does Router.navigate() do?
  2. How many parameters does it have?

    Router.navigate(['search']//first, { queryParams: { query: query }}//second)

  3. What is the second parameter of Router.navigate() used for?

  4. Why it is object ({ queryParams: { query: query }})?


Solution

  • All this questions are already answered in angular documentation:

    https://angular.io/api/router/Router#navigate

    https://angular.io/api/router/NavigationExtras