有HTML元素要包含header和footer,这样会减少返工。 有什么好的方法请指点。
我用 ng-include 和下面的代码尝试了 AngularJS
var app = angular.module("arstlApp", []);
app.controller("arstlCtrl", function($scope, $rootScope,$timeout) {
$rootScope.$on('$includeContentLoaded', function() {
$timeout(function(){
_autoload();
});
});
});
但是<ng-include
增加调用JS函数的次数。
最佳答案
我可以试试这个 <Menu-Header></Menu-Header>
在标题的每一页上
或者
<header ng-include="'includes/header.html'"></header>
页脚也是这个
关于javascript - 使用任何客户端框架在 HTML 上包含页眉和页脚的最佳方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44353366/