[Solved] How to refactor frontend JS to Angular 2 to play nicely with PHP MVC backend? [closed]


Even tho you’re getting downvotes, let me help you to start a BIG journey if you’re willing to really do that.


First, if your views are generated on the backend :

“The most part of the HTML is rendered in the PHP backend.”

According to that sentence, I imagine that you don’t have a REST API. Single Page Application are meant to live in the browser without reloading the whole page. This is going to be a problem with your current stack. (otherwise, there’s no point doing SPA).

So I’d propose you to stop generating views from your backend and return raw data (json objects). To do that, read some articles about REST APIs.


Then, you’ll need to start learning Angular2 and understand SPA logic.
I’d recommend you to take a look to the official website : http://angular.io


Honnestly, this is a very big step forward and I’m not sure you’ll be able to do that with en existing app. BUT, it’s very interesting for sure and you might want to learn more about all that before your make/participate to an other project.

Good luck

4

solved How to refactor frontend JS to Angular 2 to play nicely with PHP MVC backend? [closed]