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

前端 未结 4 1310
小鲜肉
小鲜肉 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:08

    The path-matching strategy, one of 'prefix' or 'full'. Default is 'prefix'.

    By default, the router checks URL elements from the left to see if the URL matches a given path, and stops when there is a match. For example, '/team/11/user' matches 'team/:id'.

    The path-match strategy 'full' matches against the entire URL. It is important to do this when redirecting empty-path routes. Otherwise, because an empty path is a prefix of any URL, the router would apply the redirect even when navigating to the redirect destination, creating an endless loop.

    Source : https://angular.io/api/router/Route#properties

提交回复
热议问题