manfredsteyer / multi-framework-micro-frontend

76 stars 36 forks source link

I think we do not need endsWithlogic in router. #5

Open vugar005 opened 2 years ago

vugar005 commented 2 years ago

Hi, thanks for repo. After some playing with project I realized we do not need endsWithlogic in router Problem: Because it is not going to work with params. For example, we can not march a/:id with { matcher: endsWith('a'), component: AComponent}. Solution: Instead of endsWith

    RouterModule.forRoot([
     { matcher: endsWith('a'), component: AComponent },
     { matcher: endsWith('b'), component: BComponent },
   ], { relativeLinkResolution: 'legacy' })

We can just use like below:

   RouterModule.forRoot([
      {
        path: 'mfe2',
        children: [
          { path: '', redirectTo: 'a', pathMatch: 'full' },
          { path: 'a', component: AComponent },
          { path: 'b', component: BComponent },
        ],
      },
], { relativeLinkResolution: 'legacy' })

I made sample PR which includes those small changes + feature with router params.

https://github.com/manfredsteyer/multi-framework-micro-frontend/pull/4/files

But nevertheless I think I can miss something, @manfredsteyer could you tell please why you chose endsWith? Thanks in advance.