In a project I'm working on, our MVC4 website is using a combination of Razor and Angular.js. I'm pretty new to front-end web development, so I'm confused as to if this is a good idea or not. What are the advantages and disadvantages of mixing these, and what are some scenarios that using both of these together would make sense?
Angular applications still follow an MVC style (or perhaps more correctly MVVM). In fact, they do so more explicitly than ASP.NET MVC applications do.
Simplified MVC Pattern Angular does not ask developers to split an application into different MVC components and build a code that could unite them. Rather, it only asks to divide the app and takes care of everything else.
In this post we are going to create a Single Page Application (SPA) with AngularJS and ASP.Net Core. We will use Angular-UI-Router for our application routing instead of MVC routing. Prerequisites: Before getting started make sure development environment is prepared properly.
Using Angular Development with C#They are both easy to use and have great communities and support. Consider this effective combination for your next web development project.
I can share our expirience with AngularJS + MVC4/Razor: We're using Razor only for localization - so only allowed Razor feature is "@somekeyword". As result on client side we got localized AngularJS templates. This allows to do maximum caching (even using CDN).
As for MVC4 we're using ASP.NET Web API for sending JSON data. We'd developer extension for sending HAL (Hypermedia) responses.
This gives maximum decoupling and possibility to change to another backend if needed.
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