Angular2: ng2-file-upload : cannot load it correctly using SystemJS

后端 未结 2 937
时光说笑
时光说笑 2021-01-20 15:39

I\'m using systemJS to manage my packages so I\'ve added those lines to my systemjs\'s configuration file :

{
  map: { \'ng2-file-upload\': \'node_modules/ng         


        
相关标签:
2条回答
  • 2021-01-20 16:37

    I would try this configuration:

    {
      map: { 'ng2-file-upload': 'node_modules/ng2-file-upload' },
      packages: {
        'ng2-file-upload': {
          defaultExtension: 'js'
        },
        (...)
      }
    }
    

    and import it this way:

    import { FileDrop, FileUploader } from 'ng2-file-upload/ng2-file-upload';
    
    0 讨论(0)
  • 2021-01-20 16:45

    here's my systemjs.config that works:

          var map = {
        'app': 'app', // 'dist',
        'rxjs': 'node_modules/rxjs',
        'angular2-in-memory-web-api': 'node_modules/angular2-in-memory-web-api',
        '@angular': 'node_modules/@angular',
        'ng2-file-upload': 'node_modules/ng2-file-upload'
    };
    
    
    var packages = {
        'app': { main: 'main.js', defaultExtension: 'js' },
        'rxjs': { defaultExtension: 'js' },
        'angular2-in-memory-web-api': { defaultExtension: 'js' },
        'ng2-file-upload': { main: 'ng2-file-upload.js', defaultExtension: 'js' }
    };
    
    0 讨论(0)
提交回复
热议问题