AngularJS / NodeJS

时间:2017-07-17 11:27:21

标签: angularjs node.js

我遇到包含导航栏到网站的问题。我在视图中添加了ng-include:

  <body ng-controller="ListProductController" ng-include="navigation()" ng-init="initProducts()">

在控制器中我有:

$scope.navigation = function () {
    if ('$scope.navBar' == 'user') {
        return 'views/admin/share/header.ejs';
    } else {
        return 'views/admin/share/header.ejs';
    }
}

header.ejs中的代码

<nav class="navbar navbar-default">
  <div class="container-fluid">
    <!-- Brand and toggle get grouped for better mobile display -->
    <div class="navbar-header">
      <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1"
        aria-expanded="false">
        <span class="sr-only">Toggle navigation</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
      <a class="navbar-brand" href="/">Strona Główna</a>
    </div>

    <!-- Collect the nav links, forms, and other content for toggling -->
    <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
      <ul class="nav navbar-nav">
        <li class="active"><a href="/admin/product/list">Produkty</a></li>
        <li><a href="/admin/category/list">Kategorie</a></li>
        <li><a href="/admin/user/list">Użytkownicy</a></li>
      </ul>

      <ul class="nav navbar-nav navbar-right">
        <% if (user != null) { %>
          <li><a href="">Witaj! <%= user.username %></a></li>
          <li><a href="/user/logout">Wyloguj</a></li>
          <% } else { %>
          <li><a href="/user/login">Logowanie</a></li>
          <li><a href="/user/register">Rejestracja</a></li>
           <% } %>
      </ul>
    </div>
    <!-- /.navbar-collapse -->
  </div>
  <!-- /.container-fluid -->
</nav>

路径是: C:\用户\ Turqus \桌面\节点\产品\视图\管理员\共享\ headers.ejs

问题是,当我进入页面时,产品/列表什么都没有,白色窗口。

0 个答案:

没有答案