Skip to content

Commit fd27270

Browse files
committed
Fixed refresh on dashboard
1 parent 6181d42 commit fd27270

File tree

6 files changed

+24
-8
lines changed

6 files changed

+24
-8
lines changed

app/app.module.js

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/app.module.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/app.module.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ import { SidebarModule } from './sidebar/sidebar.module';
1111
import { FooterModule } from './shared/footer/footer.module';
1212
import { NavbarModule} from './shared/navbar/navbar.module';
1313

14+
import { HashLocationStrategy, LocationStrategy } from '@angular/common';
15+
1416
@NgModule({
1517
imports: [
1618
BrowserModule,
@@ -21,6 +23,7 @@ import { NavbarModule} from './shared/navbar/navbar.module';
2123
RouterModule.forRoot([])
2224
],
2325
declarations: [ AppComponent, DashboardComponent ],
26+
providers: [{provide: LocationStrategy, useClass: HashLocationStrategy}],
2427
bootstrap: [ AppComponent ]
2528
})
2629
export class AppModule { }

app/shared/navbar/navbar.component.js

Lines changed: 8 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/shared/navbar/navbar.component.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/shared/navbar/navbar.component.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { Component, OnInit } from '@angular/core';
22
import { ROUTES } from '../.././sidebar/sidebar-routes.config';
33
import { MenuType } from '../.././sidebar/sidebar.metadata';
4+
import {Location, LocationStrategy, PathLocationStrategy} from '@angular/common';
45

56
@Component({
67
moduleId: module.id,
@@ -10,12 +11,18 @@ import { MenuType } from '../.././sidebar/sidebar.metadata';
1011

1112
export class NavbarComponent implements OnInit{
1213
private listTitles: any[];
14+
location: Location;
15+
constructor(location:Location) {
16+
this.location = location;
17+
}
1318
ngOnInit(){
1419
this.listTitles = ROUTES.filter(listTitle => listTitle.menuType !== MenuType.BRAND);
1520
}
1621
getTitle(){
17-
var titlee = window.location.pathname;
18-
titlee = titlee.substring(1);
22+
var titlee = this.location.prepareExternalUrl(this.location.path());
23+
if(titlee.charAt(0) === '#'){
24+
titlee = titlee.slice( 2 );
25+
}
1926
for(var item = 0; item < this.listTitles.length; item++){
2027
if(this.listTitles[item].path === titlee){
2128
return this.listTitles[item].title;

0 commit comments

Comments
 (0)