简体   繁体   中英

ngInclude directive in template twig symfony 2 not working

I bought an html/angular js template and i try to integrated it in symfony 2. The directive ng-include seems to be not working.

{# src/Neobe/AccueilBundle/Resources/views/layout.html.twig #}

{% extends '::base.html.twig' %}
{% block title %}
Welcome 
{% endblock %}
{% block body %}
<!-- Wrapper-->
<div id="wrapper">

<!-- Navigation -->
<div ng-include="'views/common/navigation.html'"></div>

<!-- Page wraper -->
<!-- ng-class with current state name give you the ability to extended customization urview -->
<div id="page-wrapper" class="gray-bg {[{$state.current.name}]}">

 <!-- Page wrapper -->
  <div ng-include="'views/common/topnavbar.html'"></div>

    <!-- Main view  -->
    <div ui-view></div>

    <!-- Footer -->
    <div ng-include="'views/common/footer.html'"></div>

</div>
</div>
 <!-- End page wrapper-->


{% endblock %}

The layout which is included templates, layout.html.twig , is located in my public folder of my bunlde Accueil : AccueilBundle/Resources/views/Accueil/layout.html.twig

The navigation.html template is located in my public folder of my bunlde Accueil : AccueilBundle/Resources/views/Accueil/views/common/navigation.html

Can you tell me what's wrong ?

i have no error in the browser but nothing is included.

Thank u for your help.

Angular (on client side) can't access/find any files that are outside your web directory.

So I think you have to move/copy/asset-install them to /web/.

AFAIK the syntax for the ngInclude directive is

<div ng-include src="path_to_your_html"></div>

or

<ng-include src="path_to_your_html"></ng-include>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM