AngularJS: single-page and multi-page application differences and practical use?

I studied the difference between single page applications and multi-page applications, and I think I have a good idea of ​​how they differ. A single-page application starts when one html page loads, and then it will never completely refresh the page or redefine the original if the other application is not updated (browser update, etc.) For example, the angularJS: angular-seed project has an index.html file. This file is the only page that the server sends to the interface, and after that all the other (possible) pages will be sent asynchronously under the hood using AJAX. Therefore, if you create an application with only angularjs seed, it will always be just a SPA application, right?

How in practice could you create a multi-page corner app? Wouldn't you need some corner apps? Do you need to have separate routing for each of these angularJS applications? And why do you need to make a multi-page application for angularJS? Since you can always use the first index.html as a wrapper, without real content, and then have separate container pages for different pages. Is it possible to say that an angularJS multipage application will be an application that will simply contain many angularJS SPA applications? In SPA, can you use the back button of the browser to return to the last view?

+8
angularjs ajax single-page-application
source share
1 answer

Yes, you have the idea of ​​SPA and MPA correctly.

Angular.js allows you to create a SPA, but does not force you. In MPA, I would not talk about several Angular applications, since you simply distributed Angular.js modules to several HTML pages. The logic of the page flow or routing will then be in the Angular.js controllers, in simple hyperlinks or in the backend on the server.

There may be reasons not to host the whole application under Angular.js. Perhaps part of the web application authentication may be done separately for some reason ...

In SPA hotels, you can definitely use the browser button. You just need to implement this. Twitter solves this problem by encoding the state of its web application into a URL - if you use Twitter, you might notice characters (#!) In the address bar.

+1
source share

All Articles