Skip to content
This repository has been archived by the owner on Sep 9, 2024. It is now read-only.

Unclear instruction about router pathMatch in ver 13 => 14 upgrade guide #212

Open
HarlanAtWork opened this issue Jan 6, 2023 · 0 comments

Comments

@HarlanAtWork
Copy link

HarlanAtWork commented Jan 6, 2023

One of the upgrade notes about moving from Angular 13 to 14 reads "If you are defining routes with pathMatch, you may have to cast it to Route or Routes explicitly. Route.pathMatch is no longer compatible with string type." I may have to cast what?

The second sentence contradicts the interface declaration at https://angular.io/api/router/Route, which is:

pathMatch?: 'prefix' | 'full'

So, it's still a string type. How do you cast that to Route or Routes?

More specifically, if my existing definition of routes begins

const routes: Routes = [
  { path: '', pathMatch: 'full', component: HomeComponent },

then what is the upgrade note telling me I have to do? Maybe "it" in the note refers to the route, and I need to cast

{ path: '', pathMatch: 'full', component: HomeComponent }

to a Route, but what does that have to do with being "no longer compatible with a string type"?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant