0

angular2-materialize と materialize-css を使用するために、私は一日中タイピングに取り組んでいますが、あまり運がありません。

保存オプションを指定して npm install で両方をインストールしました。

これが私が得ているエラーの1つです:

(インデックス):29 エラー: SyntaxError: 予期しないトークン <(…)

この行は次のとおりです。

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

提案?

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',
      "materialize-css": "node-modules/materialize-css",
      "angular2-materialize": "node_modules/angular2-materialize"

    },
    // 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'
      },
      'materialize-css': {
        "format": "global",
        "main": "dist/js/materialize",
        "defaultExtension": "js"
      },
      'angular2-materialize': {
        "main": "dist/index",
        "defaultExtension": "js"
      }
    }
  });
})(this);

app.component.ts

import { Component } from '@angular/core';
import 'node_modules/materialize-css';
import 'node_modules/angular2-materialize';


@Component({
    selector: 'shows-app',
    templateUrl: 'app/app.component.html',
    styleUrls: ['app/material.min.css']
})
export class AppComponent {
    pageTitle: string = 'NetShows';
    showMenu: boolean = true;
    public loggedIn: boolean = false;

    public menuButtonClick() {
        this.showMenu = !this.showMenu;
    }
}

index.html

<!DOCTYPE html>
<html style="html, body {height:100;padding:0;margin:0}">

<head lang="en">
    <base href=".">
    <title>NetShows Horse Show Management</title>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link href="app/app.component.css" rel="stylesheet" />
    <link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">

    <!--<link rel="stylesheet" href="node_modules/material-design-lite/dist/material.light_blue-amber.min.css" />-->
    <link rel="stylesheet" href="https://code.getmdl.io/1.2.1/material.indigo-pink.min.css">
    <!-- Material Design icon font -->
    <link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
    <script defer src="node_modules/material-design-lite/dist/material.min.js"></script>
    <!-- Polyfill(s) for older browsers -->
    <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/reflect-metadata/Reflect.js"></script>
    <script src="node_modules/systemjs/dist/system.src.js"></script>
    <script src="https://code.getmdl.io/1.2.1/material.min.js"></script>

    <!-- Configure SystemJS -->
    <script src="systemjs.config.js"></script>
    <script>
      System.import('app').catch(function(err){ console.error(err);  });
    </script>
</head>

<body>
    <shows-app>Loading App...</shows-app>
</body>

</html>
4

1 に答える 1