Angular 7: Что такое обновленный systemjs.config.js? - PullRequest
0 голосов
/ 12 июня 2019

Как получить действительный Angular 7 systemjs.config.js, как подробно описано в статье: Настройка Angular с нуля и обновленная systemjs.config.js версия для Angular 6 .

Мне нужно это, чтобы иметь возможность интегрировать компоненты пользовательского интерфейса Angular 7 в мое приложение Scala Play, как это сделано в seed play-angular-typescript.g8 для Angular 2. См. Интеграцию представлений Scala Playс преступником Angular 2 в index.scala.html

@()
<!doctype html>
<html lang="en" data-framework="angular2">
    <head>
        <base href="/" />
        @* In this version of the application the typescript compilation is done by the play framework.
           The browser downloads .js files. *@
        <meta charset="utf-8">
        <title>Angular Tour of Heroes</title>
        <link rel="stylesheet" href="assets/stylesheets/styles.css">
        <script type='text/javascript' src='@routes.Assets.versioned("lib/core-js/client/shim.min.js")'></script>
        <script type='text/javascript' src='@routes.Assets.versioned("lib/zone.js/dist/zone.js")'></script>
        <script type='text/javascript' src='@routes.Assets.versioned("lib/systemjs/dist/system.src.js")'></script>

        <script type='text/javascript' src='@routes.Assets.versioned("systemjs.config.js")'></script>
        @* our app is downloaded as individual javascript files by SystemJs after compilation by sbt-typescript*@
        <script>
             System.import('assets/app/main.js').catch(function(err){ console.error(err); });
        </script>
    </head>
    <body>
        <my-root>Loading...</my-root>
    </body>
</html>

, и это systemjs.config.js, позволяющий загрузить Angular 2 в представление Scala:

/**
 * System configuration for Angular samples
 * Adjust as necessary for your application needs.
 */
(function (global) {
    System.config({
        paths: {
            // paths serve as alias
            'npm:': 'assets/lib/'
        },
        // map tells the System loader where to look for things
        map: {
            // our app is within the app folder
            'app': 'assets/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',
            'angular-in-memory-web-api': 'npm:angular-in-memory-web-api/bundles/in-memory-web-api.umd.js'
        },
        // packages tells the System loader how to load when no filename and/or no extension
        packages: {
            app: {
                defaultExtension: 'js',
                meta: {
                    './*.js': {
                        loader: 'assets/systemjs-angular-loader.js'
                    }
                }
            },
            rxjs: {
                defaultExtension: 'js'
            }
        }
    });
})(this);

Я бы хотел, чтобы мое существующее приложение Scala Play использовалось в качестве основного MVC и использовало компоненты Angular 7 только для определенных видов Play.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...