0

I have two different user. One is Admin.Other one is User.I have to reuse the same LoginComponent for both User and Admin. If i will hit URL http://localhost:4200/user , then login page will come where forgot password link will be there. But i will hit URL http://localhost:4200/admin , then same login page will come where forgot password link will not be there.

In Routes i have given path like this.

const routes: Routes = [
  {
    path: 'user',
    component: LoginComponent
  },
  {
    path: 'admin',
    component: LoginComponent
  },
];

Can anyone please help me how can i have same login page with different content based on the URL hit.

ananya
  • 1,001
  • 6
  • 33
  • 50
  • 1
    One option could be [getting the current route](https://stackoverflow.com/q/34597835/4636715) (as one is `admin` other is `user`) in the component and make that *Forgot Password* mount depending on that (with [`ngIf`](https://angular.io/api/common/NgIf) or such) – vahdet Mar 19 '19 at 13:00
  • Yes, Working :). Thank you @vahdet – ananya Mar 19 '19 at 13:13

0 Answers0