What file path would I use with ng-include?

点点圈 提交于 2019-12-21 03:46:18

问题


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?


回答1:


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>


来源:https://stackoverflow.com/questions/25499228/what-file-path-would-i-use-with-ng-include

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!