2016-10-18 4 views
2

私はAngular 2を初めて使用しています。ファイルをアップロードしようとしています。そのために私はhttp://ng2-uploader.comを使用しています。私は彼らのドキュメントとREADMEファイルを経て、すべての手順を実行しますが、私は、ブラウザにこのエラーを取得していています:私たちはsystemjs.config.jsエラーAngular2 File Uploaderを使用しています。http://ng2-uploader.com

でパッケージを追加する必要があることがわかっ徹底的に検索した後

GET http://localhost:3000/ng2-uploader 404 (Not Found) 
(SystemJS) XHR error (404 Not Found) loading http://localhost:3000/ng2-uploader(…) 

ので、私の古いファイルは次のとおりです。

map: { 
    // our app is within the app folder 
    app: 'app', 
    // angular bundles 
    '@angular/core': 'npm:@angular/core/bundles/core.umd.js', 
    '@angular/common': 'npm:@angular/common/bundles/common.umd.js', 
    '@angular/compiler': 'npm:@angular/compiler/bundles/compiler.umd.js', 
    '@angular/platform-browser': 'npm:@angular/platform-browser/bundles/platform-browser.umd.js', 
    '@angular/platform-browser-dynamic': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js', 
    '@angular/http': 'npm:@angular/http/bundles/http.umd.js', 
    '@angular/router': 'npm:@angular/router/bundles/router.umd.js', 
    '@angular/forms': 'npm:@angular/forms/bundles/forms.umd.js', 
    // other libraries 
    'rxjs':      'npm:rxjs', 
    'angular-in-memory-web-api': 'npm:angular-in-memory-web-api', 
}, 
// packages tells the System loader how to load when no filename and/or no extension 
packages: { 
    app: { 
    main: './main.js', 
    defaultExtension: 'js' 
    }, 
    rxjs: { 
    defaultExtension: 'js' 
    }, 
    'angular-in-memory-web-api': { 
    main: './index.js', 
    defaultExtension: 'js' 
    } 
} 

、今の私の更新されたファイルは次のとおりです。

map: { 
    // our app is within the app folder 
    app: 'app', 
    // angular bundles 
    '@angular/core': 'npm:@angular/core/bundles/core.umd.js', 
    '@angular/common': 'npm:@angular/common/bundles/common.umd.js', 
    '@angular/compiler': 'npm:@angular/compiler/bundles/compiler.umd.js', 
    '@angular/platform-browser': 'npm:@angular/platform-browser/bundles/platform-browser.umd.js', 
    '@angular/platform-browser-dynamic': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js', 
    '@angular/http': 'npm:@angular/http/bundles/http.umd.js', 
    '@angular/router': 'npm:@angular/router/bundles/router.umd.js', 
    '@angular/forms': 'npm:@angular/forms/bundles/forms.umd.js', 
    'ng2-uploader':'npm:ng2-uploader/ng2-uploader.js', 
    // other libraries 
    'rxjs':      'npm:rxjs', 
    'angular-in-memory-web-api': 'npm:angular-in-memory-web-api', 
}, 
// packages tells the System loader how to load when no filename and/or no extension 
packages: { 
    app: { 
    main: './main.js', 
    defaultExtension: 'js' 
    }, 
    rxjs: { 
    defaultExtension: 'js' 
    }, 
    'angular-in-memory-web-api': { 
    main: './index.js', 
    defaultExtension: 'js' 
    }, 
    'ng2-uploader':{ 
    defaultExtension: 'js' 
    } 
} 

あなたは私がファイルにNG2-アップローダーを追加したが、今私は、ブラウザでこのエラーを取得しています見ての通り:

GET http://localhost:3000/node_modules/ng2-uploader/src/directives/ng-file-select 404 (Not Found) 
(index):16 Error: (SystemJS) XHR error (404 Not Found) loading http://localhost:3000/node_modules/ng2-uploader/src/directives/ng-file-select(…) 
GET http://localhost:3000/node_modules/ng2-uploader/src/directives/ng-file-drop 404 
GET http://localhost:3000/node_modules/ng2-uploader/src/services/ng2-uploader 404 (Not Found) 

これは私のapp.module.tsです:

import { NgModule }  from '@angular/core'; 
import { BrowserModule } from '@angular/platform-browser'; 
import { AppComponent } from './app.component'; 
import {UPLOAD_DIRECTIVES} from 'ng2-uploader'; 

@NgModule({ 
    imports:  [ BrowserModule ], 
    declarations: [ AppComponent, 
      UPLOAD_DIRECTIVES ], 
    bootstrap: [ AppComponent ] 
}) 
export class AppModule { } 

私はまだ何かが欠けていることを知っています。手伝ってくれませんか。あなたは、この設定を試すことができ、あなたに

+0

のために働くようです動作しません! – Mitchapp

+0

デモは機能しません。現在http://valor-software.com/ng2-file-upload/を使用しようとしています。その代わりのオプション – heman123

+0

デモがうまくいかず、あなたの質問に意味がない場合 – Mitchapp

答えて

5

ありがとう:

map: { 
    ... 
    'ng2-uploader':'npm:ng2-uploader' 
}, 
packages: { 
    ... 
    'ng2-uploader':{ 
    main: 'ng2-uploader.js', 
    defaultExtension: 'js' 
    } 
} 

も自分のデモ(http://ng2-uploader.com/demo)、私は間違っていない場合、それは私

関連する問題