Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Razor and Angular.js in an MVC4 environment

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?

like image 251
Caleb Jares Avatar asked Jan 13 '13 18:01

Caleb Jares


People also ask

Can Angular be used with MVC?

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.

Why use Angular instead of MVC?

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.

Can we use AngularJS in asp net core?

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.

Can I use C# with Angular?

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.


1 Answers

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.

like image 83
Valentyn Shybanov Avatar answered Dec 05 '22 12:12

Valentyn Shybanov