Skip to content

WebODF in Angular 2+ #950

Description

@darken89

Hi all,

I'm trying to use WebODF library in an Angular 6 project. I followed these steps:

  1. Imported library js in my index.html:
    <script src="assets/js/webodf/webodf.js" type="text/javascript" charset="utf-8"></script>

  2. 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"); }

  3. 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!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions