dqjo4340 2016-07-02 07:36
浏览 80
已采纳

在现有的Symfony2项目中集成Angularjs 2项目

We want to get rid of an old Flex project, rebuilding it into HTML5. As a result of that we're building a proof of concept in Angularjs2 and want to integrate the services in the existing PHP Symfony 2 backend. But since Angular runs 'out of the box' with nodejs on localhost:3000 and the Symfony2 project runs on localhost:8888 I get session issues. Requests sent from the localhost:3000 get different PHPSESSID back in every single call while logged in, so the server doesn't remember the user.

What is the best way to approach this problem?

Can I run the Angularjs project from localhost:8888? If I try that it complains it's not running from localhost:3000.

enter image description here

  • 写回答

2条回答 默认 最新

  • doujian0265 2016-07-02 13:13
    关注

    Ok thank you, D.Dimitrioglo, for that last comment, 'It is just a notification, is not an error. do not pay your attention to this', so I didn't spend time on figgering out why my host was unsuported. I need nodejs though to compile the TypeScript I use into Javascript, so that was not it. Also I do not explicitly need NelmioCorseBundle and FosRestBundle. My problem is

    1. I had to do a proper npm clean/install in the root of my php project, instead of copy pasting it from my angularjs/ folder.
    2. the angular/router-depricated (routing the url to different pages in a project) conflicts with the Symfony2 routing functionality so when I removed the angular router it showed the right page and could run it from localhost:8888

    After that my session was preserved after logged in! Thx for your comment it guided me in the right direction!

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器