Description
Hi all,
I'm trying to use WebODF library in an Angular 6 project. I followed these steps:
-
Imported library js in my index.html:
<script src="assets/js/webodf/webodf.js" type="text/javascript" charset="utf-8"></script>
-
In my angular component I'll try to write the sample in the website ("Getting Started"):
ngOnInit() { const odfelement = document.getElementById('odf'); const odfcanvas = new odf.OdfCanvas(odfelement); odfcanvas.load("myfile.odt"); }
-
Now, when browser performs the above statements, I get the following error in the console:
SlidesViewerComponent_Host.ngfactory.js?
[sm]:1 ERROR TypeError: core.Utils is not a constructor
at new odf.Formatting (webodf.js:254)
at new odf.OdfCanvas (webodf.js:326)
at SlidesViewerComponent.push../src/app/pages/training/slides-viewer/slides-viewer.component.ts.SlidesViewerComponent.ngOnInit (slides-viewer.component.ts:16)
at checkAndUpdateDirectiveInline (core.js:10105)
at checkAndUpdateNodeInline (core.js:11371)
at checkAndUpdateNode (core.js:11333)
at debugCheckAndUpdateNode (core.js:11970)
at debugCheckDirectivesFn (core.js:11930)
at Object.eval [as updateDirectives] (SlidesViewerComponent_Host.ngfactory.js? [sm]:1)
at Object.debugUpdateDirectives [as updateDirectives] (core.js:11922)`
I can't understand what is the problem. Could you help me?
Thank you in advance!