Using the docuvieware js in an angular ts component

Discussions about DocuVieware integration in GdPicture.NET.
Post Reply
Alex
Posts: 5
Joined: Mon Apr 16, 2018 6:39 pm

Using the docuvieware js in an angular ts component

Post by Alex » Mon May 14, 2018 6:37 pm

Hi,

I'm trying to make use of the docuvieware library from my typescript component on Angular 5+ to access the DocuviewareAPI. The demos only show how to do it from the html, I tried using the following import statement:

Code: Select all

import * as docuvieware from '../../../docuvieware-min.js';
But still I can't access it. I have it included on my angular-cli.json too, but it doesn't work either. So is there any way to use it in my ts component or it only works on the index.html?

Regards.

Alex
Posts: 5
Joined: Mon Apr 16, 2018 6:39 pm

Re: Using the docuvieware js in an angular ts component

Post by Alex » Wed May 23, 2018 10:27 pm

So no answer yet, I tried a different approach, and made a javascript file that holds all the methods that I need and it looks like this:

Code: Select all

const docuVieware = require('../../../docuvieware/docuvieware-min');

module.exports =
{ 
    docuViewareModule:
    function loadFromFile(file)
    {
        if (file != null)
        {
            var params = {
                Value: file,
                Example: false
            };
            console.log(params.Value);
            DocuViewareAPI.PostCustomServerAction("DocuVieware1", true, "loadFile", params, function(result){ console.log("result: " + JSON.stringify(result)); });
        }
    }
}
and tried adding the js file in my component like this:

Code: Select all

import * as docuvieware from './docuvieware';
but now, when I try to access that method through my component I get the following error:
docuvieware-min.js:166 Uncaught TypeError: Cannot read property 'parse' of undefined
at eval (docuvieware-min.js:166)
at eval (docuvieware-min.js:20)
at Object.eval (docuvieware-min.js:20)
at eval (docuvieware-min.js:1134)
at Object../src/docuvieware/docuvieware-min.js (main.bundle.js:208)
at __webpack_require__ (inline.bundle.js:55)
at eval (docuvieware.js:1)
at Object../src/app/components/detalleExpediente/docuvieware.js (main.bundle.js:128)
at __webpack_require__ (inline.bundle.js:55)
at eval (detalleExpediente.component.ts:7)
(anonymous) @ docuvieware-min.js:166
(anonymous) @ docuvieware-min.js:20
(anonymous) @ docuvieware-min.js:20
(anonymous) @ docuvieware-min.js:1134
./src/docuvieware/docuvieware-min.js @ main.bundle.js:208
__webpack_require__ @ inline.bundle.js:55
(anonymous) @ docuvieware.js:1
./src/app/components/detalleExpediente/docuvieware.js @ main.bundle.js:128
__webpack_require__ @ inline.bundle.js:55
(anonymous) @ detalleExpediente.component.ts:7
./src/app/components/detalleExpediente/detalleExpediente.component.ts @ main.bundle.js:121
__webpack_require__ @ inline.bundle.js:55
(anonymous) @ app.module.ts:12
./src/app/app.module.ts @ main.bundle.js:59
__webpack_require__ @ inline.bundle.js:55
(anonymous) @ main.ts:4
./src/main.ts @ main.bundle.js:224
__webpack_require__ @ inline.bundle.js:55
0 @ main.bundle.js:232
__webpack_require__ @ inline.bundle.js:55
webpackJsonpCallback @ inline.bundle.js:26
(anonymous) @ main.bundle.js:1

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests