How to add Angular 2.0 to an existing ASP.NET MVC application

I have a very large asp.net MVC 4.0 application that I would start migrating to the web API using asp.net 5.0 and Angular 2.0.

The main reason is to proceed with future corrections and the creation of some new components in the more modern SPA architecture.

My plan is to have a small section of an existing site that when routed displays an Angular SPA application that calls the Web API for data, instead of the MVC controller and functions. In this section, I do not plan to use ASP.NET MVC features such as a general layout page, linking, routing, etc., Preferring to leave it angular instead.

Both of my existing MVC and new Web api projects will use a data-level project / repository that uses EF.

My questions:

  • How does this sound? I could not find much literature on how to introduce Angular to an existing application.
  • Should I use separate projects or a whole separate solution in a new domain that accesses the same db? That is, instead of porting, run the new solution on ASP.NET 5.0
  • How to handle authentication and authorization? I am using Identity v2.0, can I mix this so that users accessing pages on the MVC site use standard form authentication, but do they use tokens when accessing the Angular / API part?

Thank you for your time.

+4
1

6 ( - Angular, Angular 2). ...

, Angular SPA, Web API , MVC

, , ASP.NET Core MVC 4. ( ), Core Angular.

ASP.NET MVC, , , .., Angular.

, Javascript . Angular2 (SystemJS, ). . .NET (Index.cshtml). Angular , .. .

, db?

Entity Framework . ( ) EF, . EF , EF Core , . .

?

, , OAuth. , IdentityServer 4 ( ), SaaS-, StormPath Auth0 ( StormPath). IdentityServer, IdentityServer 4. MVC, ; , AJAX .

, . SO " " , , , , , , :)

+4

Source: https://habr.com/ru/post/1651972/


All Articles