Ahmed Mohamed Ahmed Mohamed - 5 months ago 75
AngularJS Question

How to install Angular2 in MVC6 Project

I'm facing problem with ASP.NET5 MVC6 project. I have been create project that's using AngularJS to create Single Page Application. Now I want to install Angular 2 instead of AngularJS 1.

So what should I do to upgrade the project from normal AngularJS to Angular 2.

TGH TGH
Answer

To get a basic application configured you need to include angular2 and configure system.js

Here is an example from the documentation (https://angular.io/docs/ts/latest/quickstart.html):

<html>
  <head>
    <title>Angular 2 QuickStart</title>
    <script src="../node_modules/systemjs/dist/system.src.js"></script>
    <script src="../node_modules/angular2/bundles/angular2.dev.js"></script>
    <script>
      System.config({
        packages: {'app': {defaultExtension: 'js'}}
      });
      System.import('app/app');
    </script>
  </head>
  <body>
    <my-app>Loading...</my-app>
  </body>
</html>
Comments