2016-10-22 15 views
0

私は一人ひとりstep.But私はこのエラーを取得していますが、その後this->https://github.com/vimalavinisha/angular2-google-chart角度2エラー:(SystemJS)XHRエラー(見つかりませんでした404)

を通じて私のプロジェクトにGoogleのチャートを追加する必要がありますSystemJs.Iは(2-3ヶ月)いくつかの答えを発見したが、彼らが私のために動作しませんでした。(角2)

これは私のpackage.json

{ 
    "name": "angular-quickstart", 
    "version": "1.0.0", 
    "scripts": { 
    "start": "concurrently \"npm run tsc:w\" \"npm run lite\" ", 
    "lite": "lite-server", 
    "postinstall": "typings install", 
    "tsc": "tsc", 
    "tsc:w": "tsc -w", 
    "typings": "typings" 
    }, 
    "licenses": [ 
    { 
     "type": "MIT", 
     "url": "https://github.com/angular/angular.io/blob/master/LICENSE" 
    } 
    ], 
    "dependencies": { 
    "@angular/common": "~2.1.0", 
    "@angular/compiler": "~2.1.0", 
    "@angular/core": "~2.1.0", 
    "@angular/forms": "~2.1.0", 
    "@angular/http": "~2.1.1", 
    "@angular/platform-browser": "~2.1.0", 
    "@angular/platform-browser-dynamic": "~2.1.0", 
    "@angular/router": "~3.1.0", 
    "@angular/upgrade": "~2.1.0", 
    "angular-in-memory-web-api": "~0.1.5", 
    "bootstrap": "^3.3.7", 
    "core-js": "^2.4.1", 
    "reflect-metadata": "^0.1.8", 
    "rxjs": "5.0.0-beta.12", 
    "systemjs": "0.19.39", 
    "zone.js": "^0.6.25" 
    }, 
    "devDependencies": { 
    "concurrently": "^3.0.0", 
    "lite-server": "^2.2.2", 
    "typescript": "^2.0.3", 
    "typings":"^1.4.0" 
    } 
} 

systemjs.config.js-です---

(function (global) { 
    System.config({ 
    paths: { 
     // paths serve as alias 
     'npm:': 'node_modules/' 
    }, 
    // map tells the System loader where to look for things 
    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', 
     'angular2-in-memory-web-api': 'npm:angular2-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' 
     }, 
     'angular2-in-memory-web-api': { 
     main: './index.js', 
     defaultExtension: 'js' 
     } 
    } 
    }); 
})(this); 

tsConfig.json ---

{ 
    "compilerOptions": { 
    "target": "es5", 
    "module": "commonjs", 
    "moduleResolution": "node", 
    "sourceMap": true, 
    "emitDecoratorMetadata": true, 
    "experimentalDecorators": true, 
    "removeComments": false, 
    "noImplicitAny": false 
    } 
} 

をし、最終的にこれは私が得ているエラーです

import { NgModule }  from '@angular/core'; 
import { BrowserModule } from '@angular/platform-browser'; 
import { AppComponent } from './app.component'; 
import { GoogleChart } from 'angular2-google-chart/directives/angular2-google-chart.directive'; 

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

app.module.ts - >読み込みエラーhttp://localhost:3000/angular2-google-chart/directives/angular2-google-chart.directiveがangular2-google-」としてチャート/ディレクティブ/ angular2-google-chart.directive

私はこのエラーが発生するまでに何時間も迷っています。

答えて

0

をどのように見えるかをここで

。自分のディレクティブを作成し、angular2-google-chart.diretive.tsファイルからコピー元をコピーして貼り付けます。それが働いた唯一の方法だと私のために働いた。

0

共有したsystemjs.config.jsのサンプルを見ると、directives属性はmappackagesでありません。それは私が私の自己によってそれを解決しgithubのファイルからhttps://github.com/vimalavinisha/angular2-google-chart/blob/master/systemjs.config.js

var map = { 
    ... 
    'directives' : 'directives/' 
    }; 

    // packages tells the System loader how to load when no filename and/or no extension 
    var packages = { 
    ... 
    'directives':{ defaultExtension: 'js' } 
    }; 
+0

でも、エラーはそのままです。 – gamal

+0

node_modulesフォルダの隣にディレクティブフォルダがあり、このライブラリ用に定義されたスクリプトが必要です – Chandermani

関連する問題