symfony2 应用程序上的 Angularjs [英] Angularjs on a symfony2 application

查看:26
本文介绍了symfony2 应用程序上的 Angularjs的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个在前端使用大量 JavaScript 的 SF2 应用程序.

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

SF2 为我提供了一种很好的方式来构建一个好的 REST 应用程序、使用学说管理我的数据库、使用 twig 来创建模板等等,但我想使用 Angularjs.

SF2 provides me a good way of building a nice REST app, manage my database with doctrine, use twig for templates and so on, but I would like to use Angularjs.

我知道 angularjs 和 SF2 是采用不同方法的 2 种不同框架,但我想知道实现这项工作的最佳方法是什么.

I know that angularjs an SF2 are 2 different framework with different approach, but I'm wondering what the best way to make this work is.

值得吗?

如果是,您认为什么是更清洁、最有效的解决方案?

If yes, what do you think is the cleaner and most efficient solution?

也许使用 php 而不是 twig 模板来使用 angularjs 花括号?

Maybe use php instead of twig for templates to use angularjs curly braces ?

推荐答案

我认为 Symfony2 可以与 AngularJS 完美配合.证明是我在一侧使用 Symfony 制作 API,在另一侧使用 AnglularJS 制作 Web 应用程序.

I think Symfony2 can perfectly work well with AngularJS. Proof is I'm making an API on one side using Symfony, and a web app on the other side with AnglularJS.

此外,出于某些原因,我在我的网络应用程序中使用 Twig 生成了我的视图.每次我需要在视图中使用 Angular 时,我都只是将 angular 的花括号嵌入到一个 {% verbatim %} {% endverbatim %} 语句中.

Moreover, for some reasons I generate my views in my web app with Twig. I simply embed angular's curly braces in a twig {% verbatim %} {% endverbatim %} statement each time I need to use Angular in my views.

这篇关于symfony2 应用程序上的 Angularjs的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆