Как заставить docxtemplater работать с angular-fullstack?

Я довольно плохо знаком с генератором угловых-fullstack. Проблема, с которой я сталкиваюсь, состоит в том, что я хочу использовать docxtemplater с ним. я сделал

    npm install docxtemplater --save

а также

    import docxtemplater from 'docxtemplater';
    ...
    angular.module('newApp', [ngCookies, ngResource, ngSanitize, 'btford.socket-io', uiRouter,
      uiBootstrap, _Auth, account, admin, navbar, footer, main, constants, socket, util, testdoc, docxtemplater
    ])

в app.js

и использовал

    'use strict';
    const angular = require('angular');

    const uiRouter = require('angular-ui-router');

    var Docxtemplater= require('docxtemplater');

    import routes from './testdoc.routes';

    export class TestdocComponent {
      /*@ngInject*/
      constructor() {
        this.message = 'Hello';

        //loading the file
        var docx=new Docxtemplater().loadFromFile("test.docx");

        //setting the tags
        docx.setTags({"name":"Edgar"});

        //apply the tags
        docx.applyTags();

        //output the docx using dataUri or fs in Node
        docx.output();

      }
    }

    export default angular.module('newApp.testdoc', [uiRouter])
      .config(routes)
      .component('testdoc', {
        template: require('./testdoc.html'),
        controller: TestdocComponent,
        controllerAs: 'testdocCtrl'
      })
      .name;

в testdoc.component.js

и я получаю следующую ошибку

Ошибка: [$injector:modulerr] Не удалось создать экземпляр модуля newApp из-за: [$injector:modulerr] Не удалось создать экземпляр функции модуля Docxtemplater(content, options) из-за: [$injector:strictdi] Docxtemplater не использует явную аннотацию и не может быть вызванным в строгом режиме http://errors.angularjs.org/1.5.8/$ injector / strictdi? p0 = Docxtemplater

Любое решение для этого? Мне просто нужно установить это.:(

Кроме того, если это не работает, есть ли какая-либо другая библиотека, которая может генерировать файлы docx из шаблонов, которые можно импортировать в angular-fullstack?

0 ответов

Другие вопросы по тегам