2015-11-03 78 views
0

我想添加模板鏈接,這是工作,但我想知道是否有可能添加您的頁眉和頁腳,以及現在我抄我的頁面的頁眉和頁腳。角度routeprovider包括頁眉,頁腳和模板

這裏是我的JS:

app.config(['$routeProvider', '$locationProvider', 
     function($routeProvider, $locationProvider) { 
      $routeProvider 
       .when('/', { 
        templateUrl: 'views/startpage.html', 
        controller: 'PageCtrl', 
        controllerAs: 'page' 
       }) 
       .when('/page/test', { 
        templateUrl: 'test.html', 
        controller: 'PageCtrl', 
        controllerAs: 'page' 
       }) 

和這裏的模板IM加載它們在

<html> 
<head> 
    <meta charset="utf-8" /> 
    <link rel="stylesheet" type="text/css" href="css/bootstrap.css" /> 
    <link rel="stylesheet" type="text/css" href="css/index.css" /> 
    <script src="js/angular.min.js"></script> 
    <script src="js/angular-route.js"></script> 
    <script src="js/angular-animate.js"></script> 
    <script type="text/javascript" src="js/app.js"></script> 

    <script type="text/javascript"> 
     angular.element(document.getElementsByTagName('head')).append(angular.element('<base href="' + window.location.pathname + '" />')); 
    </script> 

    <title>SiteEngine Mobile</title> 
</head> 
<body ng-app="ngViewExample"> 
    <div class="fixedHeaderApp"> 
     <div class="headerIconLogo"> 
      <img src="img/world_icon.png" width="28px" height="28px" /> 
     </div> 
     <span class="blue">Site</span><span class="orange">Engine</span> 
    </div> 

    <div class="whitespace"></div><div class="whitespace"></div> 
    <div class="whitespace"></div><div class="whitespace"></div> 
    <div class="whitespace"></div><div class="whitespace"></div> 

    <div class="homebackimgWrapper"> 
     <div class="titleLarge">SiteEngine</div> 
     <div class="titleSmall">Mobile</div> 
    </div> 
    <div class="container"> 
     <div class="loginLogo"> 
      <img src="img/loginIcon.png" width="120px" height="120px" /> 
     </div> 

     <form action="views/startpage.html"> 
      <div class="form-group"> 
       <input type="email" class="form-control" id="exampleInputEmail1" placeholder="Email"> 
      </div> 
      <div class="form-group"> 
       <input type="password" class="form-control" id="exampleInputPassword1" placeholder="Password"> 
      </div> 
      <div class="checkbox"> 
       <label> 
        <input type="checkbox"> Ingelogd blijven 
       </label> 
      </div> 
      <button type="submit" class="btn btn-primary btnq-lg btn-block">Inloggen</button> 
     </form> 

     <div class="whitespace"></div> 

     <div ng-controller="HomeController as product"> 
      <div ng-repeat="product in product.products"> 
       <h4>{{product.name}}</h4> 
       <button ng-show="product.canPurchase">Add to stomach</button> 
      </div> 
     </div> 
    </div> 


    <script type="text/javascript" src="js/index.js"></script> 
    <script type="text/javascript"> 
     app.initialize(); 
    </script> 
</body> 

而且我有不同的菜單選項不同的頁面。

回答

-1

你可以嘗試使用ng-view作爲放置你的模板的地方。您的頁腳和頁眉將位於該ng視圖之外。你也可以直接在html中渲染你的菜單。只需將你的菜單和鏈接映射到某個地方,並將其呈現在html中即可。

+0

我並不真正遵循解決方案 –