Saturday 28 April 2018

Issues while using AngularJS with MVC


Issues while using AngularJS with MVC :
1.         Routing and Redirection becomes difficult : When we are trying to route, both the AngularJS and MVC are having routing concept, So the application gets confused to which routing should follow. And it stucked in the same page if we want to redirect to other page, actually in angularjs we use $state.go() for routing between the pages, and in MVC we use ActionResult to return View(), If we use MVC routing then we have to use $window.location.href instead of $state.go() (here state does not maintain in between controllers by using AngularJS with MVC.
2.       Maintenance Of Session becomes complicated over AngularJS Controllers : We can also not maintain $rootScope and $sessionStorage between controllers of AngularJS in case we use AngularJS with MVC.
3.       Passing data between AngularJS controllers becomes tough :  If we want to pass data from one AngularJS controller to other AngularJS controller through MVC Controller action method, then we have to use session in the action method, without using session in MVC controller we cannot pass data from one AngularJS controller to other AngularJS controller

So using AngularJS with MVC is most troublesome process, instead of that use AngularJS with WebAPI which most cool, because WebAPI is used for request and response data only and no routing is needed for WebAPI as AngularJS is having routing, and it can also maintain session between controller and no ambiguous issues occur.

No comments:

Post a Comment

Note: only a member of this blog may post a comment.