私のsystemjs.config.jsファイルは "app"を "dist"フォルダにマップします。私は比較的私のコンポーネントのhtmlファイルを参照しようとするのであれば、私は次のエラーを取得するでしょう:角2のコンポーネント相対パス
https://localhost:44337/dist/appComponent.html
の読み込みに失敗しました。私は「DIST」だけでなくフォルダにhtmlファイルをコピーするためにがぶ飲みを使用する必要がありますか?その他の選択肢は何ですか?絶対パスは完璧に動作します。
マイsystem.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: 'dist',
// angular bundles
'@angular/core': 'npm:@angular/core/bundles/core.umd.js',
App.componentファイル:事前に
import {Component, OnInit} from "@angular/core";
import {Router} from "@angular/router";
@Component({
moduleId: module.id,
selector: "my-app",
templateUrl: "appComponent.html"
})
ありがとう!