Base ASP.NET Core project with Angular 2 and TypeScript build-in
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.

README.md

ASP.NET Core with Angular 2 Base App

Base ASP.NET Core project with Angular 2 and TypeScript build-in. You can find more information on my post.

Creating the base structure for this kind of project

In order to easily recreate this structure, you can follow the commits in this repository. Each commit shows a step to configure the base structure for this kind of project.

  1. Create your ASP.NET Core project with MVC: 79174d9
  2. Add Angular 2 dependencies to your package.json: 452a86e
  3. Add Gulp tasks to copy the Angular 2 dependencies to the wwwroot folder: 1d2a6f1
  4. Update layout to include Angular 2 dependencies: d276963. Minor path fix by @mikekidder: 2b92f08
  5. Add TypeScript configuration file: bbd1842
  6. Add es6-shim's TypeScript definitions: fdbd2f3
  7. Add app.component.ts file with the sample AppComponent: 0e9567f
  8. Add boot.ts with the bootstrap of the Angular 2 application: 051a0a2
  9. Update index page with the logic to initialize the Angular 2 application: 514ce93

Adding routing suport to your Angular application

To keep this sample simple and include the feedback and code from @BradRem, I added a new branch named routing-sample with the base structure for Angular 2 routing.

Adding http suport to your Angular application

I added a new branch named http-sample with the base structure for using the HTTP service in Angular 2 to consume an ASP.NET Core API.

Full sample (with routing and http)

You can find the full solution with Angular 2 configured to use HTTP and Route components in an ASP.NET Core application in Visual Studio in the full-sample branch.