Search code examples
htmlangularjsangularjs-ng-includehtml-templates

including html template, ng-include doesn't work


I'm working on a personal project using angularJS. I downloaded this html template online and when i tested the template it is working perfectly. The problem is that when i try to include a page from the template to my project using the ng-include, nothing happens, no error but also nothing displayed just a blank page. Basically my project is structured as following :

  • src > app > template > index.html (this is the location of the template's main page).

  • src > app > components > home > home.component.html (home page of my project)

Basically i want to include index.html in home.component.html, but ng-include is not working :/

Here is my code in home.component.html :

<div ng-app = "" ng-controller = "homeController">
  <div ng-include = "'/app/template/index.html'"> </div>
</div>

thank you very much :)


Solution

  • You need to put just the way of template, like this:

    <div ng-app = "" ng-controller = "homeController">
        <div ng-include = "'/template/index.html'"> </div>
    </div>