渲染没有页眉和页脚的Angularjs specfic视图

时间:2016-04-19 22:12:26

标签: html angularjs html5 ng-view

所以我的所有页面都使用index.html来呈现页面,在index.html中,我的代码是结构化的,所有视图都在div中使用ng-view =“”标记呈现为:

  <body>
    <div class="navbar navbar-inverse" role="navigation" ng-controller="indexController" style="border-bottom: #ab2328 3px solid;">
        <div class="container">
            <div class="navbar-header">
                <button class="btn btn-success navbar-toggle" ng-click="navbarExpanded = !navbarExpanded">
                  <span class="glyphicon glyphicon-chevron-down"></span>
                </button>
                <a ng-show="!isSWA" class="navbar-brand" href="http://www.naviabenefits.com" target="_blank"><img style="height: 37px;" src="ppt/assets/navia.png"></a>
                <a ng-show="isSWA" class="navbar-brand" href="http://pebb.naviabenefits.com/" target="_blank"><img style="height: 37px;" src="ppt/assets/navia.png"></a>
            </div>
            <div class="collapse navbar-collapse" collapse="!navbarExpanded">
                <ul ng-show="!isSWA" class="nav navbar-nav navbar-right">
                    <li ng-show="authentication.isAdmin"><a href="#/admin/ppt">admin</a></li>
                    <li><a href="https://www.naviabenefits.com/products-and-services/" target="_blank">products + services</a></li>
                    <li><a href="https://www.naviabenefits.com/about/" target="_blank">about us</a></li>`
                    <li><a href="https://www.naviabenefits.com/testimonials/" target="_blank">testimonials</a></li>
                    <li><a href="https://www.naviabenefits.com/careers/" target="_blank">careers</a></li>
                    <li><a href="https://www.naviabenefits.com/news/" target="_blank">news</a></li>
                    <li><a href="https://www.naviabenefits.com/blog/" target="_blank">blog</a></li>
                    <li><a href="https://www.naviabenefits.com/contact/" target="_blank">contact us</a></li>
                    <li ng-show="authentication.isAuth"><a id="signOut" href="#/logout" >sign out <i class="fa fa-sign-out"></i></a></li>
                </ul>
            </div>
        </div>
    </div>
    <div class="container-fluid">
      <div ng-view="">
      </div>
    </div>
    <div id="footer" role="navigation" ng-controller="indexController">
        <div class="container">
            <div class="footerLinks">
            </div>
        </div>
    </div>
  </body>

所以我有几页我要渲染没有页眉和页脚,但仍保留其他一些路径。

这个“普通”页面有自己的控制器,我的app.js中的所有和我的路由如下:

$routeProvider.when("/claimReceipt-plain", {
    controller: "claimReceiptController",
    templateUrl: "ppt/views/claims/claimReceipt-plain.html"
});

我如何在这个index.html中执行此操作,并且没有页眉和页脚呈现,但我或多或少,它自己的页面?

1 个答案:

答案 0 :(得分:0)

在页面控制器上定义范围级别布尔变量,您不需要标题,并使用ng-show指令在标题div标记上应用条件。