Angular 2 with .NET Core

I'm somehow new and would like someone to help me understand how Angular 2 communicates with .net Core when building a web application.

I just read the Adam Freeman Pro MVC Core book, where he builds a sports store using an entity structure and generating razor views to display all the information. Now I'm trying to learn Angular 2 in order to better learn the interface, and it seems that everything that I learned using MVC Core Razor is now a waste of time. What is the common use of these technologies together? If I build a SPA using Angular 2, can I access the database using the web api created from the .net kernel? Is this common use? Or is there a way to create a .net application using an entity using regular controllers that generate Angular views, and not everything in the visual studio? I think they will not be cshtml files? Please help me figure this out.

Finally, I am using .net code with Angular, should I use visual studio instead if I want to use .net on the back? Thank.

+4
source share
4 answers

Yes, ASP.NET Core and Angular2 can be used together. The architecture may be as follows:

(, - , - ).

Angular2 , :

+5

.NET MVC API , , Angular SPA. SPA - .

- Razor Angular, .

Pluralsight, .

, LinkedIn - "" . , .

1 .

.

+3

Angular MVC/Razor, , , " " " ". - .

"cshtml", , html. "cs" - . MVC, .

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

, "" ASP.NET , .

-api, ASP.NET. WebApi MVC - , Microsoft. ASP.NET WebApi Angular2. Angular .

MVC-, WebApi, .

+1

JavaScript , : https://github.com/aspnet/JavaScriptServices

https://github.com/aspnet/JavaScriptServices/tree/dev/templates/AngularSpa, , Angular/.NET Core SPA.

, :

npm install -g yo generator-aspnetcore-spa
cd some-empty-directory
yo aspnetcore-spa
dotnet run

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

0

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


All Articles