How can I make the Courses > Edit menu item stay active for when it routes to courses/edit/{id}. The menu item is active on courses/edit but when I route to courses/edit/{id}, it no longer stays active. I attached two images below showing this behavior.
2 Answer(s)
-
0
Hello,
YourComponentName-routing.module.ts should be as follows:
import { CreateBookComponent } from './create-book/create-book.component'; import { EditBookComponent } from './edit-book/edit-book.component'; const routes: Routes = [ { path: '', component: BookComponent, canActivate: [authGuard, permissionGuard] }, { path: 'create', component: CreateBookComponent }, { path: 'edit/:id', component: EditBookComponent }, ];
More information on this topic can be found here: https://abp.io/community/articles/converting-createedit-modal-to-page-angularui-doadhgil
-
0
The link you provided also highlights the same problem.
Here the books menu item link is active and highlighted:
Once you route to /create, it is not longer highlighted:
The book menu item matches the path "/books" so the menu item is active, but when you route to "books/create" it no longer is a match and removes the active class from the menu item.