How do I incorporate my JavaScript library into Angular?
I have a JavaScript file named eletronic-prescription.js
function EletronicPrescriptionReport(data) {
var wrapper;
var medicineIndex;
var itemsPerPage = 3;
var prescriptionDate;
this.preview = function () {
preparePDFReport(function () {
wrapper = new ReportWrapper('p', 'mm', data, false);
var output = generateReport();
showPDF(output, "Prescrição");
});
}
....
In the past, in older projects, I would use it like this:
var report = new EletronicPrescriptionReport(response);
report.preview();
Now, while using Angular, I tried to follow the same method but encountered an error
EletronicPrescriptionReport is not a constructor
import { EletronicPrescriptionReport } from 'assets/scripts/reports/eletronic-prescription'
...
var report = new EletronicPrescriptionReport(data);
report.preview();