Skip to content

Instantly share code, notes, and snippets.

@johnpapa
Last active January 4, 2021 15:09
Show Gist options
  • Star 8 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save johnpapa/dd9b8a06bf93f4b38a3e to your computer and use it in GitHub Desktop.
Save johnpapa/dd9b8a06bf93f4b38a3e to your computer and use it in GitHub Desktop.
Getting Started Super Fast - Angular 2 CDN'd
npm init –y
npm i angular2 systemjs --save --save-exact
npm i typescript tsd live-server --save-dev
<!DOCTYPE html>
<html>
<head>
<title>Getting Started</title>
<script src="https://code.angularjs.org/tools/system.js"></script>
<script src="https://code.angularjs.org/tools/typescript.js"></script>
<script src="https://code.angularjs.org/2.0.0-alpha.39/angular2.dev.js"></script>
<script>
System.config({
transpiler: 'typescript',
typescriptOptions: { emitDecoratorMetadata: true }
});
System.import('./app.ts');
</script>
</head>
<body>
<my-app>loading...</my-app>
</body>
</html>
@vkniazeu
Copy link

Does this transpile TypeScript to JavaScript in the browser rather than locally?
I'd rather not rely on the local node_modules scripts as shown in the 5 min quickstart https://angular.io/docs/ts/latest/quickstart.html:

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

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment