The text below is the result of a recent period of immersion in this world of Angular for learning. I ask that the community help me to improve my understanding if there is something incorrect or absent.
Angularjs is a framework for the development of Single Page Applications (SPA).
A Single Page Application is, in a simple way, a web application composed of a single page. All the required Assets (HTML, CSS and JS) are loaded in a single load (the initial) and page components built dynamically using JS according to user actions.
The biggest advantage of a SPA is that the page becomes much more responsive and agile, making it the closest experience to a desktop application. When creating a page that requires extreme responsiveness, this may be the case for a SPA.
The applications of a SPA are the most varied and, mainly, with the large amount of frameworks that use this concept (Angularjs, React, Emberjs, Meteor ...) the trend is that more and more pages in this model appear.
Surely you have visited some page that works in this format as the page of Angular2, that of the Protractor or Gmail itself. When you click on the links available on the page, there is no other load: the components are updated on the same page. Any additional data required is obtained using AJAX.
Unlike PHP where its logic is running on the server side a SPA uses JS in a heavy way, i.e., requires more user station processing (to process JS) and communicates with a Back-End as needed.
A good 'side effect' of a SPA, in my opinion, is decoupling of the Front-End and Back-End logic. Analyze some Angular code and you will see that the page rendering tasks will be in the Front End.
The other tasks related to persistence (crud, as you mentioned), heavy data computations and others will be in a second application that will be the Back-End, usually offering a Rest API for data consumption.
Other commonly cited advantages are:
- The Back-End does not need to save the state of the user’s navigation, leaving this to the Front-End, where usually the task is done using local resources of the user’s station (using Web Storage, for example)
- Possibility of an application working Offline, since after downloading the Assets to the user station the application will need a Back-End only to synchronize data and other operations (Note: this brings some implications that are outside the scope of this response)
Note that this is not a universal solution but a 'case'. Many are building websites in this model by, as you said, fashion.
Why is it fashionable, hehehehe
– mau humor
I don’t have experience with angular, but I THINK it is best suited when you work with API. Where all the back end does is provide raw data (JSON).
– mau humor
You can share responsibilities with Angularjs, Front and Back-end are independent. You can use the same back-end that in this case will be a REST API for other purposes, such as mobile.
– DiegoAugusto