我是一个初学者,正在学习使用AngularJS。我试图使用ng-include
将外部HTML页面包含到我的主HTML页面中。但是问题在于我无法将其包含并且出现了404错误。以下是文件夹结构和代码:
项目文件夹结构:
buttonClick.jade (这是起始页面。)
doctype html
html(ng-app)
head
link(rel='stylesheet', href='/stylesheets/bootstrap.min.css')
link(rel='stylesheet', href='/stylesheets/style.css')
script(src='/javascripts/angular.min.js')
body(class="mainPage")
//include footer.html
include pageinclude.html
pageinclude.html
<div>
<div>Include Page Demo</div>
<div ng-include="'footer.html'"></div>
</div>
注意:
1)当我直接在.jade文件中包含footer.html
页面时,它可以正常工作。但是当我试图在HTML文件中使用ng-include进行相同的操作时,它却无法运行。
2)我也尝试了以下几种ng-include方式:
<div ng-include="'footer.html'"></div>
<ng-include src="'footer.html'"></ng-include>