0

I started writing angular2 application with RC1 version. As described in the angular.io docs I created separate system.config.js file in the root.

// system.config.js

(function (global) {


var map = {
    'app': 'app',
    'rxjs': 'node_modules/rxjs',
    '@angular': 'node_modules/@angular'

};




var packages = {

    'app': {main: 'main.js', defaultExtension: 'js'},
    'rxjs': {defaultExtension: 'js'}
};


var packageNames = [
    '@angular/common',
    '@angular/compiler',
    '@angular/core',
    '@angular/http',
    '@angular/platform-browser',
    '@angular/platform-browser-dynamic',
    '@angular/router'
];


packageNames.forEach(function (pkgName) {
    packages[pkgName] = {main: 'index.js', defaultExtension: 'js'};
});


var config = {
    map: map,
    packages: packages
};


if (global.filterSystemConfig) {
    global.filterSystemConfig(config);
}

System.config(config);
})(this);

I have given reference to find @angular modules under node_modules '@angular': 'node_modules/@angular' but it is displaying 404 you can see here. I have bootstrapped it according to the guidelines given in the docs. Here in my app/main.ts file

    /*main.ts*/

/// <reference path="../typings/browser/ambient/es6-shim/index.d.ts" />

import {bootstrap} from '@angular2/platform-browser-dynamic/';
import {AppComponent} from './app.component';

bootstrap(AppComponent);

and here is how index.html looks like

 <body>

  <my-app>Loading...</my-app>


   <script src="node_modules/es6-shim/es6-sham.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>


   <script src="systemjs.config.js"></script>
   <!--SystemsJs configuration-->

    <script>

        System.import('app/main')
            .then(null, console.error.bind(console));
   </script>

     </body>

and I have installed both @angular/core and @angular/platform-browser

Any help would be greatly appreciated!

Kunal Sharma
  • 371
  • 2
  • 20
  • 1
    Remove `2` from `'@angular2/platform-browser-dynamic/' and from `'@angular2/core` – yurzui Jun 12 '16 at 18:11
  • +1. Oh boy, such a silly mistake. Very hard to find such mistakes when the framework is not in the stable state. I was updating the code from beta to RC and things went wrong very quickly. btw Thanks. – Kunal Sharma Jun 12 '16 at 18:32

0 Answers0