commit f52132307d150cea5d35832568f61622fc4ac66c
parent 6bdf4b62319b4749e367723a169ebb25008b9c94
Author: MTRNord <mtrnord1@gmail.com>
Date: Sun, 18 Mar 2018 20:53:59 +0100
Use routerLink to reload the page
Diffstat:
3 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/src/app/app.routing.ts b/src/app/app.routing.ts
@@ -21,7 +21,7 @@ const routes: Routes = [
@NgModule({
imports: [
- RouterModule.forRoot(routes)
+ RouterModule.forRoot(routes, {onSameUrlNavigation: 'reload'})
],
exports: [
RouterModule
diff --git a/src/app/tweet-list/tweet-list.component.html b/src/app/tweet-list/tweet-list.component.html
@@ -13,7 +13,7 @@
</a>
<!-- lightbox container hidden with CSS -->
- <a href="#_" class="lightbox" #lightboxItem>
+ <a routerLink="{{currentUrl}}" class="lightbox" #lightboxItem>
<img *ngIf="item.image_urls && item.image_urls[0]" [src]="item.image_urls[0]">
</a>
diff --git a/src/app/tweet-list/tweet-list.component.ts b/src/app/tweet-list/tweet-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({
@@ -20,8 +21,9 @@ import {ToastrService} from 'ngx-toastr';
export class TweetListComponent implements OnInit {
@Input() uuid;
data: (TweetsEntity)[];
+ currentUrl: string;
- constructor(private apiService: ApiService, private toastr: ToastrService) {
+ constructor(private apiService: ApiService, private toastr: ToastrService, router: Router) {
Raven.captureBreadcrumb({
message: 'Showing Paper',
category: 'paper',
@@ -29,6 +31,11 @@ export class TweetListComponent implements OnInit {
uuid: this.uuid
}
});
+ router.events.subscribe((value) => {
+ if (value instanceof NavigationEnd ) {
+ this.currentUrl = value.url;
+ }
+ });
}
public goTo(el): void {