0

I'm using angular including from script tag like:

<html>
<head>
    <title>Angular 2 tsconfig.json Demo</title>
    <script src="https://github.jspm.io/jmcriffey/[email protected]/traceur-runtime.js"></script>
    <script src="https://jspm.io/[email protected]"></script>
    <script src="https://code.angularjs.org/2.0.0-alpha.22/angular2.dev.js"></script>
</head>
<body>
    <welcome></welcome>
    <script>System.import("app");</script>
</body>
</html>

Is there any way of avoiding script inclusion, and download my dependencies to node_modules folder with my compiled .js and typescript definition file .d.ts, include it and build it?

1 Answer 1

1

You should use npm install angular2. Check out the quickstart for more details.

You'll also need these dependencies:

  "dependencies": {
    "angular2": "2.0.0-beta.8",
    "systemjs": "0.19.22",
    "es6-promise": "^3.0.2",
    "es6-shim": "^0.33.3",
    "reflect-metadata": "0.1.2",
    "rxjs": "5.0.0-beta.2",
    "zone.js": "0.5.15"
  },

then you can include them as script tags:

  <script src="node_modules/angular2/bundles/angular2-polyfills.js"></script>
  <script src="node_modules/systemjs/dist/system.src.js"></script>
  <script src="node_modules/rxjs/bundles/Rx.js"></script>
  <script src="node_modules/angular2/bundles/angular2.dev.js"></script>

This is the minimal working setup, you'll need es6-shim and system-polyfills for IE (and possibly some other) browsers.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.