Angular 4错误:意外的令牌<

时间:2017-07-24 12:42:52

标签: asp.net asp.net-mvc visual-studio angular typescript

我使用visual studio 2015和angular 4.x构建了一个Web应用程序 我关注了this教程

但我一直在收到错误  意外的标记<

enter image description here

我的主要.ts

import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';

import { AppModule } from './app.module';



platformBrowserDynamic().bootstrapModule(AppModule);

wwwroot结构

wwwroot structure

_Layout.cshtml看起来像这样

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>@ViewBag.Title - My ASP.NET Application</title>
    @Styles.Render("~/Content/css")
    @Scripts.Render("~/bundles/modernizr")

    <script src="/node_modules/core-js/client/shim.min.js"></script>
    <script src="/node_modules/zone.js/dist/zone.js"></script>
    <script src="/node_modules/systemjs/dist/system.src.js"></script>
    <script src="/systemjs.config.js"></script>
    <script>
        System.import('wwwroot').catch(function(err){ console.error(err); });
    </script>
</head>
<body>

    <div class="container body-content">
        @RenderBody()
        <hr />
        <footer>
            <p>&copy; @DateTime.Now.Year - My ASP.NET Application</p>
        </footer>
    </div>

    @Scripts.Render("~/bundles/jquery")
    @Scripts.Render("~/bundles/bootstrap")
    @RenderSection("scripts", required: false)
</body>
</html>

systemjs.config.js

(function (global) {
    System.config({
        map: {
            'rxjs': 'node_modules/rxjs',
            '@angular': 'node_modules/@angular',
            'app': './app',
            'angular2-in-memory-web-api': 'node_modules/angular2-in-memory-web-api'
        },
        packages: {
            'app': {
                main: 'main.js',
                defaultExtension: 'js'
            },

            '@angular/platform-browser': {
                main: 'bundles/platform-browser.umd.js'
            },

            '@angular/core': {
                main: 'bundles/core.umd.js'
            },

            '@angular/http': {
                main: 'bundles/http.umd.js'
            },

            '@angular/compiler': {
                main: 'bundles/compiler.umd.js'
            },

            '@angular/compiler-cli': {
                main: 'index.js'
            },

            '@angular/router': {
                main: 'bundles/router.umd.js'
            },

            '@angular/upgrade': {
                main: 'bundles/upgrade.umd.js'
            },

            '@angular/forms': {
                main: 'bundles/forms.umd.js'
            },

            '@angular/common': {
                main: 'bundles/common.umd.js',
                defaultExtension: 'js'
            },

            '@angular/platform-browser-dynamic': {
                main: 'bundles/platform-browser-dynamic.umd.js'
            },

            '@angular/platform-server': {
                main: 'bundles/platform-server.umd.js'
            },

            'rxjs': {
                defaultExtension: 'js'
            },

            'angular2-in-memory-web-api': {
                main: './index.js',
                defaultExtension: 'js'
            }
        }
    });
})(this);

的index.html

<app-root></app-root>

我无法继续前进。 有人可以指导我吗?

谢谢!

0 个答案:

没有答案