AngularJS[ng-include]实现页面共用

来源:互联网 发布:大月氏国 知乎 编辑:程序博客网 时间:2024/06/08 04:45
<span style="font-size:32px;color:#FF0000;"><strong><span style="font-size:14px;">此处有坑:src="'header.html'" 在ng-include中,是把它的参数当做变量来解释的,它会通过$eval对传入的值进行计算,然后作为模板地址去加载。</span></strong></span><!DOCTYPE html><html lang="en" ng-app><head>    <meta charset="UTF-8">    <title>Footer Header Test</title>    <script src="angular.js"></script></head><body>    <!-- header -->      <ng-include src="'header.html'"></ng-include>                <div class="container">      <!-- angular ng-view -->          <div ng-view></div>     <!-- /angular ng-view -->      </div>            <!-- Footer -->    <ng-include src="'footer.html'"></ng-include></body></html>

1 0