I’m working on a large PHP MVC application that currently uses jQuery for handling click events and showing modal dialogs. I want to upgrade to Angular 2 to keep up with modern frontend development, but I’m running into some challenges.
The biggest issue is that Angular 2 removed controllers, which makes integration more complex. Most of my HTML gets rendered on the PHP backend side, and I mainly need JavaScript for basic interactions like button clicks and modal windows.
Here’s my concern: let’s say I have a blog page that displays multiple posts. Right now, PHP handles everything - it gets the data from MySQL, processes each post, and renders the complete HTML. If I switch to Angular 2 components, wouldn’t that mean making tons of AJAX calls for every single post? That seems inefficient.
I don’t think creating tiny Angular templates just to get click handlers on buttons is the right approach either. What’s the recommended way to make Angular 2 work smoothly alongside PHP MVC without completely restructuring my backend architecture?
honestly you might wanna consider keeping jquery for now and just adding angular selectively. i did something similar - used angular just for complex forms while php still handles most rendering. way less headache than full migration and you avoid those ajax performance issues you mentioned.
interesting problem! what about a hybrid setup? keep php for static stuff but drop angular components just where you need interactivity - like wrapping your modals in angular while leaving everything else alone. how big is this app anyway? what’s your typical user load?
Try Angular Universal for server-side rendering - it’s a solid middle ground. I dealt with something similar on a legacy PHP app. Instead of converting everything, I only added Angular components where they actually made sense - real-time comments, dynamic filters, that kind of stuff. Treat Angular like an enhancement layer, not a full replacement. Let PHP keep doing what it’s good at (data processing, initial renders) and use Angular for specific user interactions. This way you keep the performance benefits of server-side rendering while slowly modernizing your frontend. Breaking it down into small, functional pieces made the whole migration way more manageable than trying to convert everything at once.