Skip to content

Commit

Permalink
fix(demo): fix links prefixes (#2762)
Browse files Browse the repository at this point in the history
  • Loading branch information
IlyaSurmay authored and valorkin committed Sep 29, 2017
1 parent 9e4df47 commit 9a17ea9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion demo/src/app/common/top-menu/top-menu.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ <h1 class="logo" [routerLink]="['']">
</div>
<ul *dropdownMenu class="dropdown-menu" role="menu">
<li role="menuitem" *ngFor="let item of previousDocs">
<a class="dropdown-item" [href]="appUrl + (isLocalhost ? item.unprefixedUrl : item.url) + (appHash ? '/' + appHash : '')">{{item.version}}</a>
<a class="dropdown-item" [href]="appUrl + (needPrefix ? item.url : item.unprefixedUrl) + (appHash ? '/' + appHash : '')">{{item.version}}</a>
</li>
</ul>
</div>
Expand Down
2 changes: 2 additions & 0 deletions demo/src/app/common/top-menu/top-menu.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export class TopMenuComponent implements AfterViewInit {
public currentVersion: string;
public previousDocs: string[] = [];
public isLocalhost = false;
public needPrefix = false;

public constructor(
private router: Router,
Expand All @@ -22,6 +23,7 @@ export class TopMenuComponent implements AfterViewInit {
public ngAfterViewInit(): any {
// todo: remove this sh**
this.isLocalhost = location.hostname === 'localhost';
this.needPrefix = location.pathname !== '/';
const getUrl = (router: Router) => {
const indexOfHash = router.routerState.snapshot.url.indexOf('#');

Expand Down

0 comments on commit 9a17ea9

Please sign in to comment.