AspNet-Core-MVCビューでレンダリングしたときにboot.jsをロードできません ApsNetコア+ Angular2 RC4アプリケーションを作成しようとしました。以下は、私がアプリケーションをビルドするために行った手順です。 1.小さな(RC4)クイックスタートチュートリアルからPackage.json、systemjs.config.js、typings.json、tsconfig.jsonを作成/更新しました。私の必要性ごとに 2.すべてのangular2コンポーネントをscriptsフォルダの下に置き、tsconfig.jsonも同じ場所に配置します。しかし、すべての透明化された.jsファイルをwwwroot/appScripts/folderに移動するために、outDirプロパティを指定しました。AspNet-Core-MVCビューでレンダリングしたときにboot.jsを読み込めません
{
"compilerOptions": {
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"module": "commonjs",
"noEmitOnError": true,
"noImplicitAny": true,
"outDir": "../wwwroot/appScripts/",
"removeComments": false,
"sourceMap": true,
"suppressImplicitAnyIndexErrors": true,
"moduleResolution": "node",
"target": "es6"
},
"compileOnSave": true,
"exclude": [
"node_modules",
"wwwroot"
]
}
- は 'アプリ' マッピング
- アプリケーションが読み込まれると、最初はログインページに戻り、認証時には「Views/Home/index.cshtml」ビューにリダイレクトされます。ログインコントローラによってレンダリングされます。
- この「ビュー/ホーム/ index.cshtmlは、」ビューを持っている/ マイ 『ビュー/ホーム/ index.cshtmlを』ファイル「./shared/layout.cshtml」に設定したレイアウトの下に、以下のようである
(function (global) {
// map tells the System loader where to look for things
var map = {
'app': 'app', // 'dist',
'@angular': 'lib/@angular',
'rxjs': 'lib/rxjs'
};
// packages tells the System loader how to load when no filename and/or no extension
var packages = {
'app': { main: 'boot.js', defaultExtension: 'js' },
'rxjs': { defaultExtension: 'js' }
};
var ngPackageNames = [
'common',
'compiler',
'core',
'http',
'platform-browser',
'platform-browser-dynamic',
'router',
'router-deprecated',
'upgrade',
];
// Add package entries for angular packages
ngPackageNames.forEach(function (pkgName) {
packages['@angular/' + pkgName] = { main: pkgName + '.umd.js', defaultExtension: 'js' };
}) ;
var config = {
map: map,
packages: packages
}
System.config(config);
})(this);
@{
ViewData["Title"] = "Home Page";
Layout = "_Layout";
}
<!-- IE required polyfills, in this exact order -->
<script src="~/lib/core-js/client/shim.min.js"></script>
<script src="~/lib/zone.js/dist/zone.js"></script>
<script src="~/lib/reflect-metadata/Reflect.js"></script>
<script src="~/lib/systemjs/dist/system.src.js"></script>
<!-- 2. Configure SystemJS -->
<script src="systemjs.config.js"></script>
<script src="https://d3js.org/d3.v3.min.js" charset="utf-8"></script>
<script>
System.import('app').catch(function (err) { console.error(err); });
</script>
私は最初からそれを開発する際には、angular2していました - ベータ17版、今はAngular2 RC4に移行しています。 問題今私は、アプリケーションがboot.jsファイルをロードすることはできませんされている直面していますし、アプリケーションがブートをロード/識別することができないのはなぜ私は、ブラウザのコンソール
menu.js:103 Uncaught TypeError: $(...).tooltip is not a function
http://localhost:55413/Home/app/boot.js Failed to load resource: the server responded with a status of 404 (Not Found)
Index:54 Error: Error: XHR error (404 Not Found) loading http://localhost:55413/Home/app/boot.js
at XMLHttpRequest.wrapFn [as _onreadystatechange] (http://localhost:55413/lib/zone.js/dist/zone.js:769:30)
at ZoneDelegate.invokeTask (http://localhost:55413/lib/zone.js/dist/zone.js:356:38)
at Zone.runTask (http://localhost:55413/lib/zone.js/dist/zone.js:256:48)
at XMLHttpRequest.ZoneTask.invoke (http://localhost:55413/lib/zone.js/dist/zone.js:423:34)
Error loading http://localhost:55413/Home/app/boot.js(anonymous function) @ Index:54
http://localhost:55413/app/boot.js Failed to load resource: the server responded with a status of 404 (Not Found)
Index:84 Error: Error: XHR error (404 Not Found) loading http://localhost:55413/app/boot.js
at XMLHttpRequest.wrapFn [as _onreadystatechange] (http://localhost:55413/lib/zone.js/dist/zone.js:769:30)
at ZoneDelegate.invokeTask (http://localhost:55413/lib/zone.js/dist/zone.js:356:38)
at Zone.runTask (http://localhost:55413/lib/zone.js/dist/zone.js:256:48)
at XMLHttpRequest.ZoneTask.invoke (http://localhost:55413/lib/zone.js/dist/zone.js:423:34)
Error loading http://localhost:55413/app/boot.js
に次のエラーを取得しています.jsファイル、私はそれを読み込む間違ったパスを指していますか?私は何をする必要があるのですか?
を出力ディレクトリを指し、スクリプトが私の実際の角度成分が存在する私のtypescriptですフォルダを参照tscoと一緒にnfig.jsonファイル。私はboot.jsにappScriptsの接頭辞を付けることであなたの提案を試みました:{main: 'appScripts/boot.js'、defaultExtension: 'js'}、まだ同じエラーが発生していますエラー:XHRエラー(404 Not Found) :// localhost:55413/Home/app/appScripts/boot.js Index:84エラー:エラー:XHRエラー(404が見つかりません)をロードしています:http:// localhost:55413/app/appScripts/boot.js(...) – Krishnan