Base solution for your next web application
Open Closed

How to switch from AngularJS to MPA #274


User avatar
0
mpm created

Sorry for the simple question, but how does one change the default backend app from AngularJS to MPA.

Thanks, MPM


4 Answer(s)
  • User Avatar
    0
    hikalkan created
    Support Team

    Hi,

    ASP.NET Zero is a startup kit/template as you know. If you have custom pages created using AngularJs controllers and views, there is not an automatic way of converting it to MPA. They are completely different architectures. This is not unique to ASP.NET Zero. There is no such a technology yet to convert a SPA to MPA.

    If you don't have started your development, just create a new project from the web site. If you have some created pages, then you can adapt your pages to MPA version of your project one by one. If you have not much page, this can be efficient. But if there are too many pages, it gets much time.

    This was the UI part. Server-side code is almost 100% compatible. I did not change single line of code for application and domain layers while creating the MPA version.

    Thanks, Have a nice day.

  • User Avatar
    0
    mpm created

    Hi,

    My question is even more basic than that. How do I configure a newly created app to use the MPA backend, rather than the AngularJS backend. I think by default the app uses the AngularJS backend.

  • User Avatar
    0
    hikalkan created
    Support Team

    :) Then it's very simple. When you login, you're redirected to ApplicationController's Index action. You can change this behavior in the AccountController's Login methods. If you want, you can completely delete the App folder in order to remove the Angular application.

    Alternatively, you can open ApplicationController and change it to:

    [AbpMvcAuthorize]
        public class ApplicationController : AbpZeroTemplateControllerBase
        {
            [DisableAuditing]
            public ActionResult Index()
            {
                return RedirectToAction("Index", "Home", new {area = "Mpa"});
            }
        }
    
  • User Avatar
    0
    mpm created

    Thank you very much!