Anjular 4 integration with CakePhp 3


#1

Hi,
I’ve been using cake for a while and, on a new project, I’d like to use Angular 4 to manage my front-end.
I’m new to Angular and I can’t figure out how to merge Cake and Angular to make if work.

I guess I should use Cake’s layout and load < my-app > into it. But how to load Angular and the app’s content?

I’m stuck and some help would be appreciated.
Thanks, Leica69


#2

You have to load Angular in the templates.

About the data, you can use Crud with crud-json-api


#3

Thaks raul338,
The point is that i don’t know how to load Angular in the template.
I don’t see a .js I could call to launch Angular.


#4

Hey there, I don’t have the answer, but I recently saw this talk


Also there is this:

Good luck:)


#5

Tha’ts for v1 of angular…


#6

The app is started in the same way if I’m not mistaking?
So regardless of version, you should be able to follow the same structure to integrate:)
Alternatively, you can keep them separate and run them on different servers.
That has worked very well for me:) That will force you to create proper API’s, and so should you want to add another front-end later (say mobile) you can do that np. For managing your API I can recommend Swagger.


#7

It is not started the same way…


#8

You have to link JS files in the templates, it is in the cookbook

You can link Angular files and your other js files


#9

This maybe just old but if you are trying to do angular 2+ you really should start the angular app as you normally do (as a separate repo) and have it make http requests to what happens to be cakePHP.