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

时间:2021-09-28 22:51:37

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

的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

home.html的

<h1> home! </h1>

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

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

Anyone see my mistake?

有谁看到我的错误?

1 个解决方案

#1


32  

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

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

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

#1


32  

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

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

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