I don't really know how to combine Angular and C#.
Like I have controllers provided with the MVC and Asp.Net, but I have also controllers provided by angular, so what should I use? The routing provided by angular-route or the routing of the MVC? Also should in Angular I have the ng-repeat attribute and in C# I have the foreach.
I don't really know how to combine these two languages in Asp.Net? Could someone explain me the best approach.. Thanks a lot!
I can think of two possible ways to implement
AngularJS & C#application completely.
AngularJS application will be stand-alone app, handle all UI logics,
routing logic, UI template, have own view models.C# application (I recommend you to use WebAPI/WCF or anything you're comfortable with) will expose HTTP endpoints for AngularJS application to call
NodeJS instead), server & client code could be implemented by two different teams, etc...AngularJS, sometimes not easy to debug for beginner, need extra effort to secure the endpointsJsonResult for them to be friendly with JS app)C# code => easier for C# devs, easier to test (unit test, automation test your code), easier to implement authentication & authorization logic (MVC do it for you), faster to develop (in my opinion), etcHope it helps.
There are 2 different things. Your C# controllers will run on the server while Angular controllers will run on the browser. When you combine C# + Angular is like building to separate applications: a C# (asp.net) app that runs server-side and a JavaScript (angular) app that runs client-side.
C# controllers will handle http requests while angular controllers will coordinate the interaction of the different Angular components that are running on the browser.
I recommend you this hands-on to get started: https://www.asp.net/web-api/overview/getting-started-with-aspnet-web-api/build-a-single-page-application-spa-with-aspnet-web-api-and-angularjs
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With