Angularjs on a symfony2 application

前端 未结 15 1708
面向向阳花
面向向阳花 2020-12-12 09:55

I\'m working on a SF2 application that uses a lot of javascript on the front end.

SF2 provides me a good way of building a nice REST app, manage my database with doc

15条回答
  •  [愿得一人]
    2020-12-12 10:58

    In theory, you would have only your index page being rendered from symfony, so you don't have to use twig at all. you only need to render first page and then angular framework takes over. Angularjs has its own template syntax and capabilities. I don't think there is a need to mix those two, as you can completely separate both frameworks.Perhaps, make your server respond with file index.html (your angular app) on yourdomain.com, and everything from symfony comes from /api prefix, or something like that. Just imagine your WebApi project is one server and angularjs project on the other. they would only talk through api calls, no need to mix templates at all, in my opinion.

提交回复
热议问题