commit 1a33a69b027037547a489b650fa7ec93147812f7
parent dd40cf8ab191dd83140b4642816fabf4654d8574
Author: MTRNord <mtrnord1@gmail.com>
Date: Wed, 21 Mar 2018 19:13:04 +0100
Debug menu checkCurrent and add missing functions for the papers-list
Diffstat:
2 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/src/app/app.component.ts b/src/app/app.component.ts
@@ -17,7 +17,9 @@ export class AppComponent {
}
checkCurrent(path = '/'): string {
- return (this.currentUrl === path) ? null : 'active';
+ const active = (this.currentUrl === path) ? null : 'active';
+ console.log('Route: ' + path + ' Active?: ' + active);
+ return active;
}
}
diff --git a/src/app/papers-list/papers-list.component.ts b/src/app/papers-list/papers-list.component.ts
@@ -10,6 +10,7 @@ import 'rxjs/add/operator/take';
import 'rxjs/add/operator/concat';
import 'rxjs/add/observable/throw';
import {ToastrService} from 'ngx-toastr';
+import {NavigationEnd, Router} from '@angular/router';
@Component({
selector: 'app-papers-list',
@@ -18,18 +19,32 @@ import {ToastrService} from 'ngx-toastr';
})
export class PapersListComponent implements OnInit {
data: (Paper)[];
+ currentUrl: string;
- constructor(private apiService: ApiService, private toastr: ToastrService) {
+ constructor(private apiService: ApiService, private toastr: ToastrService, router: Router) {
Raven.captureBreadcrumb({
message: 'Listing Papers',
category: 'papers-list'
});
+ router.events.subscribe((value) => {
+ if (value instanceof NavigationEnd ) {
+ this.currentUrl = value.url;
+ }
+ });
}
ngOnInit() {
this.getPapers();
}
+ hide(el) {
+ el.style.display = '';
+ }
+
+ goTo(el): void {
+ el.style.display = 'block';
+ }
+
getPapers() {
this.apiService.getPapers()
// TODO: Better variable naming