Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/464.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Symfony2-带AngularJS的束_Javascript_Php_Angularjs_Symfony - Fatal编程技术网

Javascript Symfony2-带AngularJS的束

Javascript Symfony2-带AngularJS的束,javascript,php,angularjs,symfony,Javascript,Php,Angularjs,Symfony,我正在做一个项目,它主要基于Symfony2和Twig模板。我现在确实想基于AngularJS编写一个新的包。也就是说,大多数站点的菜单和导航仍然使用php/Twig,但是用户列表应该使用AngularJS编写。 我已启动AngularJS前端,并使用如下文件结构运行: 应用程序/ js/ app.js 分部/ users.html user_detail.html index.html 鲍尔元件/ 现在,我只想在Symfony2中的给定路径下显示它。 有没有一种方法可以说,我

我正在做一个项目,它主要基于Symfony2和Twig模板。我现在确实想基于AngularJS编写一个新的包。也就是说,大多数站点的菜单和导航仍然使用php/Twig,但是用户列表应该使用AngularJS编写。 我已启动AngularJS前端,并使用如下文件结构运行:

  • 应用程序/
    • js/
      • app.js
    • 分部/
      • users.html
      • user_detail.html
    • index.html
  • 鲍尔元件/
现在,我只想在Symfony2中的给定路径下显示它。 有没有一种方法可以说,我不希望Symfony中的任何控制器用于前端-只是静态交付

对于此类应用,什么是一般合理的方法? 我找到的大多数教程都假设,整个站点是用Angular编写的,而不仅仅是一个包


谢谢你的提示

我以前使用过
asoc/assetic angular js bundle
(),当与assetic过滤器配置一起使用时,这意味着所有的部分和脚本都被合并到一个文件中

他们的github页面说在你的小树枝模板中使用以下内容

{% javascripts filter="angular"
    '@BundleName/Resources/views/aTemplate.html.ng'
    '@BundleName/Resources/views/fooTemplate.html.ng'
    '@BundleName/Resources/views/moarTemplates/*.html.ng'
    %}
        <script type="text/javascript" src="{{ asset_url }}"></script>
{% endjavascripts %}
然后,您可以在twig javascripts部分调用您的partials,如下所示

{% javascripts
    '@BundleName/Resources/views/angular-app.js'
    '@BundleName/Resources/views/angular-controllers.js'
    '@BundleName/Resources/views/some-other-stuff.js'
    '@BundleName/Resources/views/aTemplate.html.ng'
    '@BundleName/Resources/views/fooTemplate.html.ng'
    '@BundleName/Resources/views/moarTemplates/*.html.ng'
    %}
        <script type="text/javascript" src="{{ asset_url }}"></script>
{% endjavascripts %}
{%javascripts
“@BundleName/Resources/views/angular app.js”
“@BundleName/Resources/views/angular controllers.js”
“@BundleName/Resources/views/some other stuff.js”
“@BundleName/Resources/views/aTemplate.html.ng”
“@BundleName/Resources/views/fooTemplate.html.ng”
“@BundleName/Resources/views/moarTemplates/*.html.ng”
%}
{%endjavascripts%}
然后,我想您可以将上面的内容包含在希望它显示的一个细枝视图中,也可以将其包含在所有模板中(取决于您希望如何处理脚本缓存和其他内容),然后使用常规的
ng视图
UserListController
类型标记调用它


抱歉,如果这与您的问题无关。在我开始写这篇文章时,它非常有意义,但我对它的观察如此之多,似乎我刚刚偏离了正轨。

我以前使用过
asoc/assetic angular js bundle
(),当与assetic filter配置一起使用时,这意味着所有的部分和脚本都被合并到一个文件中

他们的github页面说在你的小树枝模板中使用以下内容

{% javascripts filter="angular"
    '@BundleName/Resources/views/aTemplate.html.ng'
    '@BundleName/Resources/views/fooTemplate.html.ng'
    '@BundleName/Resources/views/moarTemplates/*.html.ng'
    %}
        <script type="text/javascript" src="{{ asset_url }}"></script>
{% endjavascripts %}
然后,您可以在twig javascripts部分调用您的partials,如下所示

{% javascripts
    '@BundleName/Resources/views/angular-app.js'
    '@BundleName/Resources/views/angular-controllers.js'
    '@BundleName/Resources/views/some-other-stuff.js'
    '@BundleName/Resources/views/aTemplate.html.ng'
    '@BundleName/Resources/views/fooTemplate.html.ng'
    '@BundleName/Resources/views/moarTemplates/*.html.ng'
    %}
        <script type="text/javascript" src="{{ asset_url }}"></script>
{% endjavascripts %}
{%javascripts
“@BundleName/Resources/views/angular app.js”
“@BundleName/Resources/views/angular controllers.js”
“@BundleName/Resources/views/some other stuff.js”
“@BundleName/Resources/views/aTemplate.html.ng”
“@BundleName/Resources/views/fooTemplate.html.ng”
“@BundleName/Resources/views/moarTemplates/*.html.ng”
%}
{%endjavascripts%}
然后,我想您可以将上面的内容包含在希望它显示的一个细枝视图中,也可以将其包含在所有模板中(取决于您希望如何处理脚本缓存和其他内容),然后使用常规的
ng视图
UserListController
类型标记调用它


抱歉,如果这与您的问题无关。在我开始写这篇文章时,它非常有意义,但我对它的观察如此之多,似乎我刚刚偏离了正轨。

我以前使用过
asoc/assetic angular js bundle
(),当与assetic filter配置一起使用时,这意味着所有的部分和脚本都被合并到一个文件中

他们的github页面说在你的小树枝模板中使用以下内容

{% javascripts filter="angular"
    '@BundleName/Resources/views/aTemplate.html.ng'
    '@BundleName/Resources/views/fooTemplate.html.ng'
    '@BundleName/Resources/views/moarTemplates/*.html.ng'
    %}
        <script type="text/javascript" src="{{ asset_url }}"></script>
{% endjavascripts %}
然后,您可以在twig javascripts部分调用您的partials,如下所示

{% javascripts
    '@BundleName/Resources/views/angular-app.js'
    '@BundleName/Resources/views/angular-controllers.js'
    '@BundleName/Resources/views/some-other-stuff.js'
    '@BundleName/Resources/views/aTemplate.html.ng'
    '@BundleName/Resources/views/fooTemplate.html.ng'
    '@BundleName/Resources/views/moarTemplates/*.html.ng'
    %}
        <script type="text/javascript" src="{{ asset_url }}"></script>
{% endjavascripts %}
{%javascripts
“@BundleName/Resources/views/angular app.js”
“@BundleName/Resources/views/angular controllers.js”
“@BundleName/Resources/views/some other stuff.js”
“@BundleName/Resources/views/aTemplate.html.ng”
“@BundleName/Resources/views/fooTemplate.html.ng”
“@BundleName/Resources/views/moarTemplates/*.html.ng”
%}
{%endjavascripts%}
然后,我想您可以将上面的内容包含在希望它显示的一个细枝视图中,也可以将其包含在所有模板中(取决于您希望如何处理脚本缓存和其他内容),然后使用常规的
ng视图
UserListController
类型标记调用它


抱歉,如果这与您的问题无关。在我开始写这篇文章时,它非常有意义,但我对它的观察如此之多,似乎我刚刚偏离了正轨。

我以前使用过
asoc/assetic angular js bundle
(),当与assetic filter配置一起使用时,这意味着所有的部分和脚本都被合并到一个文件中

他们的github页面说在你的小树枝模板中使用以下内容

{% javascripts filter="angular"
    '@BundleName/Resources/views/aTemplate.html.ng'
    '@BundleName/Resources/views/fooTemplate.html.ng'
    '@BundleName/Resources/views/moarTemplates/*.html.ng'
    %}
        <script type="text/javascript" src="{{ asset_url }}"></script>
{% endjavascripts %}
然后,您可以在twig javascripts部分调用您的partials,如下所示

{% javascripts
    '@BundleName/Resources/views/angular-app.js'
    '@BundleName/Resources/views/angular-controllers.js'
    '@BundleName/Resources/views/some-other-stuff.js'
    '@BundleName/Resources/views/aTemplate.html.ng'
    '@BundleName/Resources/views/fooTemplate.html.ng'
    '@BundleName/Resources/views/moarTemplates/*.html.ng'
    %}
        <script type="text/javascript" src="{{ asset_url }}"></script>
{% endjavascripts %}
{%javascripts
“@BundleName/Resources/views/angular app.js”
“@BundleName/Resources/views/angular controllers.js”
“@BundleName/Resources/views/some other stuff.js”
“@BundleName/Resources/views/aTemplate.html.ng”
“@BundleName/Resources/views/fooTemplate.html.ng”
“@BundleName/Resources/views/moarTemplates/*.html.ng”
%}
{%endjavascripts%}
然后,我想您可以将上面的内容包含在希望它显示的一个细枝视图中,也可以将其包含在所有模板中(取决于您希望如何处理脚本缓存和其他内容),然后使用常规的
ng视图
UserListController
类型标记调用它

抱歉,如果这与您的问题无关。在我写这篇文章的开始,它让我