Working functionality to navigate back from attachments to event-detail

This commit is contained in:
Tiago Kayaya
2020-08-27 12:36:09 +01:00
parent 876be2a267
commit e79a04dc99
3 changed files with 14 additions and 3 deletions
@@ -1,7 +1,7 @@
<ion-header>
<ion-toolbar>
<ion-buttons slot="start">
<ion-back-button routerDirection="back" defaultHref="" icon="chevron-back"></ion-back-button>
<ion-back-button (click)="navigateBack()" defaultHref="" icon="chevron-back"></ion-back-button>
</ion-buttons>
<ion-title>Anexos do evento</ion-title>
</ion-toolbar>
@@ -1,3 +1,7 @@
ion-back-button {
display: block;
}
/* CONTENT */
ion-content{
--background: #f2f2f2;
@@ -1,7 +1,7 @@
import { Component, OnInit } from '@angular/core';
import { AttachmentsService } from 'src/app/services/attachments.service';
import { Attachment } from 'src/app/models/attachment.model';
import { ActivatedRoute } from '@angular/router';
import { ActivatedRoute, Router } from '@angular/router';
import { InAppBrowser } from '@ionic-native/in-app-browser/ngx';
@Component({
@@ -12,8 +12,9 @@ import { InAppBrowser } from '@ionic-native/in-app-browser/ngx';
export class AttachmentsPage implements OnInit {
loadedEventAttachments: Attachment[];
pageId: string;
constructor(private attachamentsService: AttachmentsService, private activatedRoute: ActivatedRoute, private iab: InAppBrowser) { }
constructor(private attachamentsService: AttachmentsService, private activatedRoute: ActivatedRoute, private iab: InAppBrowser, private route: Router) { }
ngOnInit() {
/* Emit new data when something changes */
@@ -30,6 +31,8 @@ export class AttachmentsPage implements OnInit {
{
this.attachamentsService.getEventAttachments(eventid).subscribe(attachments => {
this.loadedEventAttachments = attachments;
this.pageId = eventid;
console.log(this.pageId);
});
}
@@ -39,4 +42,8 @@ export class AttachmentsPage implements OnInit {
browser.show();
}
navigateBack(){
this.route.navigate(['/home/events',this.pageId]);
}
}