Farata / angular2typescript

Code samples from the book Angular 2 Development with TypeScript
MIT License
440 stars 269 forks source link

chapter2 - hello-world-ts & hello-world-es6 can't launch #34

Closed 404157386 closed 5 years ago

404157386 commented 6 years ago

They all hit error:

GET https://unpkg.com/rxjs@5.0.0-beta.12/Subject 404 ()

Please check, thank you!

404157386 commented 6 years ago

It can run successfully after add the rxjs package at System.config:

      packages: {
+       'rxjs'                             : {main: 'bundles/Rx.js'},
        '@angular/core'                    : {main: 'index.js'},
        '@angular/common'                  : {main: 'index.js'},
        '@angular/compiler'                : {main: 'index.js'},
        '@angular/platform-browser'        : {main: 'index.js'},
        '@angular/platform-browser-dynamic': {main: 'index.js'}
      }

or

add rxjs to script tag directly and remove System.config:

  <script src="//unpkg.com/core-js/client/shim.min.js"></script>
  <script src="//unpkg.com/zone.js@0.8.4"></script>
  <script src="//unpkg.com/typescript@2.0.0"></script>
  <script src="//unpkg.com/systemjs@0.19.37/dist/system.src.js"></script>
+ <script src="//unpkg.com/rxjs@5.0.0-beta.0/bundles/Rx.js"></script>
  <script>
    System.config({
      transpiler: 'typescript',
      typescriptOptions: {emitDecoratorMetadata: true},
      map: {
-       'rxjs': 'https://unpkg.com/rxjs@5.0.0-beta.12',
        '@angular/core'                    : 'https://unpkg.com/@angular/core@2.0.0',
        '@angular/common'                  : 'https://unpkg.com/@angular/common@2.0.0',
        '@angular/compiler'                : 'https://unpkg.com/@angular/compiler@2.0.0',
        '@angular/platform-browser'        : 'https://unpkg.com/@angular/platform-browser@2.0.0',
        '@angular/platform-browser-dynamic': 'https://unpkg.com/@angular/platform-browser-dynamic@2.0.0'
      },
      packages: {
        '@angular/core'                    : {main: 'index.js'},
        '@angular/common'                  : {main: 'index.js'},
        '@angular/compiler'                : {main: 'index.js'},
        '@angular/platform-browser'        : {main: 'index.js'},
        '@angular/platform-browser-dynamic': {main: 'index.js'}
      }
    });
    System.import('main.ts');
  </script>

They all can work. Can you update your code, please?

ahromov commented 5 years ago

Yea, can you update your code?)

yfain commented 5 years ago

Please use the code samples for the second edition of this book at https://github.com/Farata/angulartypescript.