ASP.NET MVC and Angularjs vs ASP.NET MVC and Reactjs - angularjs

I have used AngularJs on top of my ASP.NET mvc projects. Even though both AngularJs and ASP.NET are based on mvc architecture I can see some advantages when using AngularJs on top of my ASP.NET mvc projects. The main advantage that I see in this approach is better rendering of views. If so why not use ReactJs with ASP.NET mvc since it is purely focusing on views. Why do we have to mess up with two mvc frameworks. Won't it be better to use Reactjs on top of ASP.NET mvc than using AngularJs and ASP.NET mvc combination (Note that I will always use ASP.NET mvc and I don't want to use a pure JavaScript framework). Please correct me if I am wrong. Thanks in advance.

I've used both angular and react in projects in the past. With angular you dirty your html markup with angular code. With react it's all encapsulated in a component. As I was never an expert with angular I may not have used it to the best of it's ability but to me Reactjs seems like the better framework and seems like a better fit with ASP.NET MVC.
I don't believe there is one correct tool to do the job though. It's really whatever suits your needs and what your comfortable with. I would suggest giving Reactjs a shot though.

Related

Spring MVC with AngularJS a good combination?

I had now two little projects with Spring MVC, Thymleaf, HTML, Bootstrap and vanilla JS/JQuery.
So I far I don't have much skills with AngularJS.
So I am curious about your oppinion if it makes sense to try to build up another project with Spring MVC and AngularJS combined or if these two doesn't fit that well together?
Ty
My Recommendation would be Spring boot + Angular as this is the combination of two best frameworks available in the market.
Please have a look at JHIPSTER as it is project generating tool to create awesome project with so many already built in functionality and wide community support.
AngularJS is one thing. Is a front end framework.
Spring MVC is another thing. Is a back end framework.
Then everything is good with AngularJS. And everything is good with Spring MVC.
AngularJS is old. Try to get a Angular4 experience for example. My opinion.

SPA behaviour for an existing Play Framework webapp

We have a complex webapp built in Play Framework (1.*) and we want to move towards a SPA behaviour for it. What JS framework would you recommend for this? Most of the business logic is on the server side (Play controllers).
What would be the pros or cons of using AngularJS or ReactJS, or maybe other framework. How easy would be the integration?
Take a look at the act framework at http://actframework.org/, an ex play one that decided to take action, his video for a Rest Service is very impressive: https://www.youtube.com/watch?v=B2RRSzYeo8c
From my experience , I can recommend the following :
Indeed, You will have two applications :
SPA application : Based on reactjs framework with redux .
API application : You can any of the famous framework grails , express, laravel , ruby-on-rails ...etc.
I don't recommend to use Angular, ReactJS is more powerful for many reasons : namely virtual-dom
You can use still Play 1.x as back-end, by converting controllers methods into web-socket events or more simple REST (checkout jersey module, also for inspiration).
After you can make interacting UI HTML SPA based use ReactJS or VueJS (I prefer the second, better separation concerns and better performances).

AngularJS with asp.net webforms or MVC?

We have an asp.net website running in our company. This website majorly use AJAX calls to interact with server and for that we have web methods in our code behind files.
Company is thinking to switch technology to Angular JS. I just want to know whether it is a good practice to use Angular JS with asp.net webforms or we have to convert from webforms to
asp.net MVC in order to switch to Angular JS? I have already read relevant questions but I need more specific answers, any one please put a light on this.
As I look at it, it doesn't really matter what you use, because angularjs is implemented using only javascript and html code, and in both cases I don't think that implementing it in either asp or mvc will have any major impact, this does depend on your project size and complexity but for the most part I don't think you will face any problems.Then again this is just my viewpoint on this matter.

Can i create a SPA using jquery and javascript and Asp.NET MVC and without thirdparty js framework?

I want to create a Asp.NET MVC SPA application using .net , jquery, javascript. These technology stack is fine to create a SPA application or i must use knockout or ember or angular in my SPA Application?
For SPA, you should choose a JavaScript framework such as Angular, Aurelia or any other. If you use jQuery, you can still create a SPA but it requires a lot of plumbing. Also, its harder to maintain application state using jQuery.
Yes. it is possible to make single page application in asp.net core without using any third party javascript framework.
Check this nuget Package : https://www.nuget.org/packages/AjaxSpaMvcCore/
Github Repository : https://github.com/KishorNaik/Sol_Ajax_Spa_MVC_Core

AngularJS vs multiple forms in ASP.NET MVC

I'm building a complex job application. And I want it to be a SPA. I'm using AngularJS with Asp.net MVC (not web API). Everything is working so far, but I realized that I can no longer take advantage of a lot of features that ASP.NET MVC provides. So far I know I have to write my own code for these features:
all validation have to be on client side. I can't reuse some attributes I wrote in C#.
[ValidateAntiForgeryToken] attribute no longer work.
I can't use classes that generated by entity framework directly. It will give "circular reference" error for that.
I almost regret to take this approach. It's nice to have 2-way binding, but I have to write a lot of extra code that I could have avoided if I don't use angularJS. I can write multiple forms in one page and achieve the same result like shown here:
Multiple Forms in same page ASP.net MVC.
Can you tell what other MVC features I still have to write code for? when should I use angularJS and when should I use ASP.NET multiple forms on the same page?
Thanks
You can ease the pain of those listed points, but still, it might be better to decide what's better for you from the beginning - rendering views client-side (angular) or server-side (mvc).
Anyways, there are known solutions for some of the listed issues. Angular directive for MVC validation attributes:
https://github.com/alisabzevari/ngval
For the [ValidationAntiForgeryToken] here is also a solution: https://julianjelfs.wordpress.com/category/mvc/
I have not understood the thing regarding multiple forms (I believe it's unrelated to angular), so skipped on this..

Resources