使用System.js配置加载的ExcelJS没有显示错误,但是Angular App未加载

时间:2018-12-25 08:00:20

标签: angular systemjs exceljs

我正在尝试将文件保护程序和exceljs加载到我的自定义Web项目中,在该项目中,运行时角度应用程序是单独加载的,因为它是一个基于JSP Servlet的旧版Web项目,因此我并没有单独构建整个角度项目CLI。我正在使用systemjs配置文件来加载模块。文件保存器工作正常,但是当我尝试使用exceljs时,未加载有角度的应用程序。控制台上也不会引发任何错误。

这是我的systemjs.config.js文件

$conn = mysqli_connect($server_name, $mysql_username, $mysql_password, 
$db_name);
if($conn === false){
die("ERROR: Could not connect. " . mysqli_connect_error());
}

 $number= $_POST['number'];


 $sql1 = "SELECT * FROM abc_table LIMIT WHAT TO ENTER HERE  ";

这是我使用ExcelJS的地方

/**
 * WEB ANGULAR VERSION
 * (based on systemjs.config.js in angular.io)
 * System configuration for Angular samples
 * Adjust as necessary for your application needs.
 */
(function (global) {
  System.appVersion='2.13';
  System.config({
    transpiler: 'ts',
    typescriptOptions: {
      "target": "es5",
      "module": "system",
      "moduleResolution": "node",
      "sourceMap": true,
      "emitDecoratorMetadata": true,
      "experimentalDecorators": true,
      "lib": ["es2015", "dom"],
      "noImplicitAny": true,
      "suppressImplicitAnyIndexErrors": true
    },
    meta: {
      'typescript': {
        "exports": "ts"
      }
    },
    paths: {
      // paths serve as alias
      'npm:': 'https://unpkg.com/'
    },
    // map tells the System loader where to look for things
    map: {
      // our app is within the app folder
      'app': './../app',

      // angular bundles
      '@angular/animations': './../js/angular4/@angular-4.4.6/animations.umd.js',
      '@angular/animations/browser': './../js/angular4/@angular-4.4.6/animations-browser.umd.js',
      '@angular/core': './../js/angular4/@angular-4.4.6/core.umd.js',
      '@angular/common': './../js/angular4/@angular-4.4.6/common.umd.js',
      '@angular/common/http': './../js/angular4/@angular-4.4.6/common-http.umd.js',
      '@angular/compiler': './../js/angular4/@angular-4.4.6/compiler.umd.js',
      '@angular/platform-browser': './../js/angular4/@angular-4.4.6/platform-browser.umd.js',
      '@angular/platform-browser/animations': './../js/angular4/@angular-4.4.6/platform-browser-animations.umd.js',
      '@angular/platform-browser-dynamic': './../js/angular4/@angular-4.4.6/platform-browser-dynamic.umd.js',
      '@angular/http': './../js/angular4/@angular-4.4.6/http.umd.js',
      '@angular/router': './../js/angular4/@angular-4.4.6/router.umd.js',
      '@angular/router/upgrade': './../js/angular4/@angular-4.4.6/router-upgrade.umd.js',
      '@angular/forms': './../js/angular4/@angular-4.4.6/forms.umd.js',
      '@angular/upgrade': './../js/angular4/@angular-4.4.6/upgrade.umd.js',
      '@angular/upgrade/static': './../js/angular4/@angular-4.4.6/upgrade-static.umd.js',

      // other libraries
      'rxjs':                      'npm:rxjs@5.0.1',
      'tslib':                     './../js/angular4/typescript@2.3.2/tslib@1.8.1.js',

      'ts':                        './../js/angular4/typescript@2.3.2/plugin-typescript@5.2.7.js',
      'typescript':                './../js/angular4/typescript@2.3.2/typescript.js',

      'lodash':                    './../js/angular4/lodash@4.17.4.js',           
      'exceljs':                   './../js/angular4/exceljs',
      'file-saver':                'npm:file-saver',

      //Datatable-Locally maintained
      'angular-2-datatable':        './../js/angular4/Angular-2-Datatable'    

    },
    // packages tells the System loader how to load when no filename and/or no extension
    packages: {
      app: {
        main: 'main',
        defaultExtension: 'ts?v='+System.appVersion,
        /*meta: {
          './*.ts': {
            loader: 'systemjs-angular-loader.js'
          }
        }*/
      },
      rxjs: {
        defaultExtension: 'js'
      },
      'exceljs': {
        main: './dist/dist/es5/exceljs.browser.js',
        defaultExtension: 'js'
      },
     // 'angular2-datatable': { defaultExtension: 'js' },    
     //'ngx-filter-pipe': { main: 'dist/bundles/ngx-filter-pipe.umd.js' },
     'angular-2-datatable': {
         main: 'index.js',
         defaultExtension: 'js'
      },
      'file-saver': {
        format: 'global',
        main: './dist/FileSaver.js',
        defaultExtension: 'js'
      }
    }
  });

})(this);

我还在main.ts文件中包含以下日志

import * as Excel from 'exceljs';
import { saveAs } from 'file-saver';

export class AlertSubscriptionExportExcel {
    static export = (data: any) => {    
        const workbook: Excel.Workbook = new Excel.Workbook;
        const worksheet = workbook.addWorksheet('Car Data');

        const title = "Alert Subscription Report";
        const titleRow = worksheet.addRow([title]);

        worksheet.addRow([]);
        worksheet.addRow([]);
        worksheet.addRow([]);
        worksheet.addRow([]);


}

打印日志,但此后什么也没发生。

如果我在使用Workbook Object的行中添加了注释,则应用程序会轻松加载。

我在哪里错了?

0 个答案:

没有答案