jQuery 如何使用 Angularjs 包含页眉和页脚?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/21932570/
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-27 01:46:04 来源:igfitidea点击:
How to include header and footer using Angularjs?
提问by Abilash
In my projects i'm using jquery "load" method to inject the header and footer in all pages (ref the below code), here my question is how to achieve the same using angularjs.
在我的项目中,我使用 jquery“加载”方法在所有页面中注入页眉和页脚(参考下面的代码),这里我的问题是如何使用 angularjs 实现相同的目的。
$("header").load("includes/header.html"); $("footer").load("includes/footer.html");
回答by Satpal
回答by Prashobh
In your index.html or master page you can add
在您的 index.html 或母版页中,您可以添加
<div ng-include="'includes/header.html'"></div>
<div ui-view=""></div> // here you can manage other views
<div ng-include="'includes/footer.html'"></div>
For more references
更多参考