Coder Social home page Coder Social logo

nbellocam / angular2aspnetcorebaseapp Goto Github PK

View Code? Open in Web Editor NEW
25.0 8.0 15.0 50 KB

Base ASP.NET Core project with Angular 2 and TypeScript build-in

Home Page: http://blog.nbellocam.me/2016/03/14/asp-net-core-and-angular-2/

License: MIT License

C# 67.61% JavaScript 26.28% TypeScript 2.78% CSS 3.33%

angular2aspnetcorebaseapp's Introduction

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.

angular2aspnetcorebaseapp's People

Contributors

mikekidder avatar nbellocam avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

angular2aspnetcorebaseapp's Issues

Issue with IE

Full sample branch code works fine with Chrome. Not working with internet explorer

Support for Deep Linking

I believe a fundamental experience is the ability to handle deep linking, which is where the user clicks on shortcut or types in a URL such as http://localhost/app/feature/10 and the website will go directly to that page. A URL entered this way (or a page that is reloaded by the user) will be handled by the server, instead of Angular. Since the server won't find a Controller/Action, it will 404.

I'd like to suggest this base template include at least the code to allow deep linking and page refreshes.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.