U
U
Urukhayy2016-12-28 15:50:58
Angular
Urukhayy, 2016-12-28 15:50:58

How to connect to Angular 2 from .html?

According to this article, for Angular2 binding, use the following connections:

<head>
    <title>Angular 2 QuickStart</title>

    <!-- 1. Загрузите библиотеки -->
    <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>

    <!-- 2. Настройте SystemJS -->
    <script>
      System.config({
        packages: {        
          app: {
            format: 'register',
            defaultExtension: 'js'
          }
        }
      });
      System.import('app/boot')
            .then(null, console.error.bind(console));
    </script>

  </head>

In my case, this page is issued via express (res.sendFile).
These script files are not loaded . Played with the location of the paths. Moreover, this article describes not the most optimal quickstart for Angular2, you have to bind to the versions of all dependencies in the package.json file.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nikolai Kupstas, 2016-12-28
@Illorian

Just use angular-cli and you will be happy

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question