Skip to content

Instantly share code, notes, and snippets.

@enappd
Created June 1, 2021 22:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save enappd/0db15ace9e0af73a41f6d173cbec6a14 to your computer and use it in GitHub Desktop.
Save enappd/0db15ace9e0af73a41f6d173cbec6a14 to your computer and use it in GitHub Desktop.
Ionic app PDF generation
import { Component } from '@angular/core';
import { environment } from '../../environments/environment';
import { InvoiceComponent } from '../components/invoice/invoice.component';
import { ModalController } from '@ionic/angular';
@Component({
selector: 'app-home',
templateUrl: 'home.page.html',
styleUrls: ['home.page.scss'],
})
export class HomePage {
public order = environment.orderData;
constructor(private modalCtrl: ModalController) { }
async openInvoice(order) {
const InvoiceModal = await this.createModal(InvoiceComponent, { order });
await InvoiceModal.present();
}
async createModal(component, componentProps?, cssClass?): Promise<HTMLIonModalElement> {
const modal = await this.modalCtrl.create({
component,
cssClass,
componentProps,
backdropDismiss: true
});
return modal;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment