Question

I am putting together a ZF2+Angular application but I am not sure the best way to incorporate ZF2 routes with Angular routes.

Should I keep one main route to do the ng-view then call from there the angular routes? If so, how should I define the ZF2 routes so it will work with Angular routing and not be looking for ZF2 controllers and actions?

UPDATE: I did not fully understand AngularJs routes before I posted this. You are correct, they are different ZF2 != Angular routes..of course.

In order to get this working in a hybrid environment I needed to realize that Angular is more for a single page app SPA, so having my ZF2 taking me to a general page, where the SPA routes can be applied from there is the solution.

app/login <- zf route.. - calls app/api/login (zf route) from angular and redirects to app/main <- zf route for the main application app/main/#angular-route <- an angular route inside the main zf route

Was it helpful?

Solution

Angular = Frontend, ZF2 = Backend.

These two only play together in a way that Angular will call routes of ZF2 to fill angulars views with some data. Angular routes and ZF2 routes have no common ground.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top