Discover a helpful solution at this URL :
The tutorial mentioned might not be applicable anymore as it requires npm installation of angular v2.0.0 beta2 and the latest version of Typescript (currently 1.8). However, TS 1.8 is compatible with Angular2 beta7 or higher (older versions work well with TS 1.7.5), resulting in an error message:
"node_modules/angular2/src/facade/promise.d.ts(1,10): error TS2661: Cannot re-export name that is not defined in the module."
Reference 1 : https://github.com/angular/angular/issues/6795
Reference 2 : https://github.com/angular/angular/issues/6468
Here's how to tackle it :
To start, globally install Typescript using :
npm install -g typescript
Then include dependencies in your package.json as follows :
{
"name": "test",
"private": true,
"version": "0.0.0",
...
}
The "start" line within "scripts" enables simultaneous compiler, server, and sails server startup using:
npm start
Update dependencies to the latest versions by running :
npm update --save
Add the code below into a new tsconfig.json file at your Sails application root for Typescript configuration.
{
...
}
Create a typings.json file in the app root to introduce additional library capabilities per angular.io guidelines.
{
...
}
If you're using EJS as the template engine, append the provided script tags to your layout.ejs.
...
The initialized /app/main.ts script will serve as the entry point for Angular 2. To prevent 404 errors for added scripts, modify express.js in the config folder.
var express = require('express');
module.exports.http = {
customMiddleware: function (app) {
app.use('/node_modules', express.static(process.cwd() + '/node_modules'));
}
};
Integrate two Typescript files into assets/app/ directory for compilation purposes.
Execute "npm start" and visit localhost:1337 to view "My First Angular 2 App."
Hope this walkthrough helps!
Alix