Skip to content

Commit

Permalink
Fix bug where clicking on "home" in batches causes sidebar to switch
Browse files Browse the repository at this point in the history
  • Loading branch information
jumpcutfindo committed Aug 3, 2021
1 parent 963d9f6 commit d5db6c3
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/app/navigation/nav-controller/nav-controller.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ export class NavControllerComponent implements OnInit {
this.router.events.subscribe((val) => {
if (val instanceof NavigationEnd) {
this.loadingService.setLoading(true);
console.log(val);
this.navControllerService.onRouteUpdate(val);
this.navigateToLink(val.url);
}
Expand Down Expand Up @@ -94,7 +93,9 @@ export class NavControllerComponent implements OnInit {
pages = ['home', 'about', 'batches', 'sov', 'listen', 'contribute', 'misc']
navigateToLink(url: string) {
for(let i = 0; i < this.pages.length; i ++) {
if(url.toLowerCase().includes(this.pages[i])) {
let sourceUrl = url.split("#")[0];

if(sourceUrl.toLowerCase().includes(this.pages[i])) {
let temp = this.menu.filter(x => x.linkName.includes(this.pages[i]));
this.navigateTo(temp[0]);
return;
Expand Down

0 comments on commit d5db6c3

Please sign in to comment.