How to navigate to other page in angular 6?

前端 未结 4 443
粉色の甜心
粉色の甜心 2021-02-04 04:38

Im trying to redirect my page from login to another page. Im following this code.

My login component ts file:

import { Router } from \'@angular/router\';         


        
4条回答
  •  孤街浪徒
    2021-02-04 05:32

    navigateByUrl expects an absolute path, so a leading / might take you to the right page

    You could also use navigate and don't need the leading / but the syntax is slightly different as it expects an array for the path

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

提交回复
热议问题