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