我将使用ng-include的文件路径是什么?

Zac*_*ack 14 html partials filepath angularjs angularjs-ng-include

我的角度项目的路径是这样的

web
    server.py ##flask server program
    app
        static
            app.js
            controllers.js
            etc...
        templates
            index.html
            home.html
Run Code Online (Sandbox Code Playgroud)

的index.html

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

<!-- nor did this -->
<ng-include src="home.html"></ng-include>
Run Code Online (Sandbox Code Playgroud)

home.html的

<h1> home! </h1>
Run Code Online (Sandbox Code Playgroud)

除了我在输出中没有看到部分(home.html).

有谁看到我的错误?

Rag*_*dra 33

ng-include的src属性需要一个字符串.您可以传递范围变量,也可以直接传递字符串.

<ng-include src=" 'templates/home.html' "></ng-include>
Run Code Online (Sandbox Code Playgroud)