What file path would I use with ng-include?

Zack picture Zack · Aug 26, 2014 · Viewed 22.9k times · Source

My angular project's path is like this

web
    server.py ##flask server program
    app
        static
            app.js
            controllers.js
            etc...
        templates
            index.html
            home.html

index.html

<!-- this didn't work -->
<ng-include src="templates/home.html"><ng-include>

<!-- nor did this -->
<ng-include src="home.html"></ng-include>

home.html

<h1> home! </h1>

Except I don't see the partial (home.html) in my output.

Anyone see my mistake?

Answer

Raghavendra picture Raghavendra · Aug 26, 2014

The src attribute of ng-include expects a string. Either you pass a scope variable, or pass string directly.

<ng-include src=" 'templates/home.html' "></ng-include>