Html 我将与 ng-include 一起使用什么文件路径?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/25499228/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 02:33:54 来源:igfitidea点击:
What file path would I use with ng-include?
提问by Zack
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
索引.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
主页.html
<h1> home! </h1>
Except I don't see the partial (home.html) in my output.
除了我在输出中没有看到部分(home.html)。
Anyone see my mistake?
有人看到我的错误吗?
回答by Raghavendra
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>