In Angular, What is 'pathmatch: full' and what effect does it have?

前端 未结 4 1322
小鲜肉
小鲜肉 2020-11-30 02:49

In here it is use pathmatch as full and when i delete this pathmatch it doesn\'t even load the app or run the project

import { NgModule } from \'@angular/cor         


        
4条回答
  •  醉话见心
    2020-11-30 03:30

    pathMatch = 'full' results in a route hit when the remaining, unmatched segments of the URL match is the prefix path

    pathMatch = 'prefix' tells the router to match the redirect route when the remaining URL begins with the redirect route's prefix path.

    Ref: https://angular.io/guide/router#set-up-redirects

    pathMatch: 'full' means, that the whole URL path needs to match and is consumed by the route matching algorithm.

    pathMatch: 'prefix' means, the first route where the path matches the start of the URL is chosen, but then the route matching algorithm is continuing searching for matching child routes where the rest of the URL matches.

提交回复
热议问题