miércoles, 4 de mayo de 2016

Setup of Environment with VS Code for Angular 2

1. Download Visual Studio Code from https://code.visualstudio.com/Download

2. Create a new directory named example1

3. Open Visual Studio Code

4. Open the directory with Visual Studio Code

5. Create the files tsconfig.json, typings.json, package.json, index.html,systemjs.config.js in example1 directory

6. Copy the contents of tsconfig.json from https://angular.io/docs/ts/latest/quickstart.html to tsconfig.json

7. Copy the contents of typings.json from https://angular.io/docs/ts/latest/quickstart.html to typings.json

8. Copy the contents of package.json from https://angular.io/docs/ts/latest/quickstart.html to package.json

9. Copy the contents of index.html from https://angular.io/docs/ts/latest/quickstart.html to index.html

10. Copy the contents of systemjs.config.js from https://angular.io/docs/ts/latest/quickstart.html to systemjs.config.js

11. Create a directory named app in example1

12. Create a file named app.component.ts with the following content or copy it from https://angular.io/docs/ts/latest/quickstart.html

import { Component } from '@angular/core';

@Component({
  selector: 'my-app',
  template: '<h1>Angular 2 Example with VS Code</h1>'
})
export class AppComponent { }



13. Create  main.ts with the following content or copy it from https://angular.io/docs/ts/latest/quickstart.html

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

14. Save all your files


15. On Visual Studio Code click on Debug


16. Click on the Gear



17. Select Node.js as environment


18. Open View/Command Palette

19. Type Tasks: Configure Task Runner


20. Select TypeScript - tsconfig.json



21. Open a terminal or console and go into to the example directory

22. execute the command npm install

23. Open .vscode/launch.json

24. search for program into configurations


25. change the value to
"program": "${workspaceRoot}/node_modules/lite-server/bin/lite-server",


Note: you may need to run npm install -g typescript to execute typescript commands.

26. Open View/Command Palette

27: Type Task: Run Task

28. Select tsc

28: Run F5 to run the application






No hay comentarios:

Publicar un comentario