Document Viewer Review

This commit is contained in:
Paulo Pinto
2020-08-27 15:59:51 +01:00
parent e0536a2307
commit 551366b5ad
12 changed files with 135 additions and 8 deletions
@@ -3,6 +3,8 @@ import { AttachmentsService } from 'src/app/services/attachments.service';
import { Attachment } from 'src/app/models/attachment.model';
import { ActivatedRoute, Router } from '@angular/router';
import { InAppBrowser } from '@ionic-native/in-app-browser/ngx';
import { AlertController, ModalController } from '@ionic/angular';
import { ViewerPage } from 'src/app/pages/events/attachments/viewer/viewer.page'
@Component({
selector: 'app-attachments',
@@ -14,7 +16,7 @@ export class AttachmentsPage implements OnInit {
loadedEventAttachments: Attachment[];
pageId: string;
constructor(private attachamentsService: AttachmentsService, private activatedRoute: ActivatedRoute, private iab: InAppBrowser, private route: Router) { }
constructor(private attachamentsService: AttachmentsService, private activatedRoute: ActivatedRoute, private iab: InAppBrowser, private route: Router, private modalCtrl: ModalController) { }
ngOnInit() {
/* Emit new data when something changes */
@@ -32,14 +34,28 @@ export class AttachmentsPage implements OnInit {
this.attachamentsService.getEventAttachments(eventid).subscribe(attachments => {
this.loadedEventAttachments = attachments;
this.pageId = eventid;
console.log(this.pageId);
});
}
viewDocument(documenturl:string)
async viewDocument(documenturl:string)
{
const browser = this.iab.create(documenturl);
//var ref = cordova.InAppBrowser.open(documenturl, '_blank', 'location=yes');
const browser = this.iab.create(documenturl, "_self")
browser.show();
// const modal = await this.modalCtrl.create({
// component: ViewerPage,
// componentProps: {
// externalLink: documenturl
// },
// cssClass: 'viewer',
// backdropDismiss: false
// });
// await modal.present();
// modal.onDidDismiss();
}
navigateBack(){