0

我在下面有柱塞代码,此代码用于显示一些子组件:

子组件内的 HTML 如下所示:

<div>
      <h3>I'm the Child component</h3>
    </div>

Plnkr 代码如下所示:

https://embed.plnkr.co/aYET8s/

但是每当我运行柱塞时,我都会收到“正在加载..”文本。

为什么我没有在浏览器中看到“我是子组件”?

能否请你帮忙?

4

1 回答 1

2

改变config.js使用rxjs@5angular/core@5

  map: {

    'app': './src',

    //'@angular/core': 'npm:@angular/core/bundles/core.umd.js',
    '@angular/core': 'npm:@angular/core@5/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',
    '@angular/animations': 'npm:@angular/animations/bundles/animations.umd.js',
    '@angular/platform-browser/animations': 'npm:@angular/platform-browser/bundles/platform-browser-animations.umd.js',
    '@angular/animations/browser': 'npm:@angular/animations/bundles/animations-browser.umd.js',

    '@angular/core/testing': 'npm:@angular/core/bundles/core-testing.umd.js',
    '@angular/common/testing': 'npm:@angular/common/bundles/common-testing.umd.js',
    '@angular/compiler/testing': 'npm:@angular/compiler/bundles/compiler-testing.umd.js',
    '@angular/platform-browser/testing': 'npm:@angular/platform-browser/bundles/platform-browser-testing.umd.js',
    '@angular/platform-browser-dynamic/testing': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic-testing.umd.js',
    '@angular/http/testing': 'npm:@angular/http/bundles/http-testing.umd.js',
    '@angular/router/testing': 'npm:@angular/router/bundles/router-testing.umd.js',

    //'rxjs': 'npm:rxjs',
    'rxjs': 'npm:rxjs@5',
    'typescript': 'npm:typescript@2.2.1/lib/typescript.js'
  },

PLNKR 上的DEMO

于 2018-06-05T08:39:28.237 回答