在 symfony2 中引用静态模板 [英] Reference a static template in symfony2
问题描述
我想在 symfony2 中使用 angular.为此,应该可以从这样的引用加载模板:
加载是角度的一部分.我们只需要提供模板的路径.模板不应该用树枝渲染.symfony 可以做到这一点吗?
简单地制作一个没有 twig 标签的模板,以及一个通过 ajax 加载的路由.不需要控制器
my_template:路径:/路径/到/模板默认值:_controller: FrameworkBundle:Template:template模板:'AcmeBundle:Angular:template.html.twig'
更多信息:http://symfony.com/doc/current/cookbook/templating/render_without_controller.html
I want to use angular with symfony2. To do so it should be possible to load a template from a reference like this:
<div ng-include="/link/to/template.html"></div>
The loading is the part of angular. We just have to provide a path to the template. The template should not be rendered with twig. Is this possible with symfony?
Simple make a template without twig tags, and a route for it to load via ajax. No controller is required
my_template:
path: /path/to/template
defaults:
_controller: FrameworkBundle:Template:template
template: 'AcmeBundle:Angular:template.html.twig'
More infos: http://symfony.com/doc/current/cookbook/templating/render_without_controller.html
这篇关于在 symfony2 中引用静态模板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!