在Visual Studio 2017中在MVC4上安装Angular 2,未定义系统

时间:2017-10-12 18:50:37

标签: javascript asp.net-mvc angular asp.net-mvc-4

我目前正在关注此tutorial以在我现有的asp.net项目上安装Angular 2。但是,在我完成所有操作并运行它之后,我收到以下错误:

enter image description here

这里和那里有类似的线程,但没有一个解决方案没有帮助我。我安装了node.js并创建了以下文件。

enter image description here

enter image description here

<!---app.component.ts:--->

    import { Component } from '@angular/core';
    @Component({
        selector: 'my-app',
        template: 'My First Angular App - Demo'
    })
    export class AppComponent { }

 import { NgModule }      from '@angular/core';
    import { BrowserModule } from '@angular/platform-browser';
    import { AppComponent }   from './app.component';
    @NgModule({
      imports:      [ BrowserModule ],
      declarations: [ AppComponent ],
      bootstrap:    [ AppComponent ]
    })
    export class AppModule { }

&LT; --- main.ts:---&GT;

import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { AppModule } from './app.module';
const platform = platformBrowserDynamic();
platform.bootstrapModule(AppModule);

{
  "name": "dataplex",
  "version": "1.0.0",
  "scripts": {},
  "license": "ISC",
  "dependencies": {
    "@angular/common": "~2.0.1",
    "@angular/compiler": "~2.0.1",
    "@angular/core": "~2.0.1",
    "@angular/forms": "~2.0.1",
    "@angular/http": "~2.0.1",
    "@angular/platform-browser": "~2.0.1",
    "@angular/platform-browser-dynamic": "~2.0.1",
    "@angular/router": "~3.0.1",
    "@angular/upgrade": "~2.0.1",
    "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": {
    "@types/core-js": "^0.9.34",
    "typescript": "^2.0.3",
    "typings": "^1.4.0"
  }
}

{
  "compileOnSave": true,
  "compilerOptions": {
    "target": "es6",
    "module": "commonjs",
    "moduleResolution": "node",
    "sourceMap": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "removeComments": false,
    "noImplicitAny": false,
    "typeRoots": [
      "node_modules/@types"
    ],
    "types": [
      "core-js"
    ]
  }
}
   {
      "globalDependencies": {
        "core-js": "registry:dt/core-js#0.0.0+20160725163759",
        "jasmine": "registry:dt/jasmine#2.2.0+20160621224255",
        "node": "registry:dt/node#6.0.0+20160909174046"
      }
    }

&lt; ----我在这里调用应用程序:---&gt;

    <my-app>Loading...</my-app>

</span>

@section scripts {
    <Script src="http://~/node_modules/core-js/client/shim.min.js"></Script>
    <Script src="http://~/node_modules/zone.js/dist/zone.js"></Script>
    <Script src="http://~/node_modules/reflect-metadata/Reflect.js"></Script>
    <Script src="http://~/node_modules/systemjs/dist/system.src.js"></Script>

    <script src="~/Scripts/systemjs.config.js"></script>

    <script>
        System.import('../../Scripts/App/main').catch(function (err) { console.error(err); });
    </script>

&lt; ---我在渲染时不会在index.cshtml中获得任何输出。有什么想法吗?

0 个答案:

没有答案