Navigation.html内容
<div class="collapse navbar-collapse" id="app-navbar-collapse">
<!-- Right Side Of Navbar -->
<ul class="nav navbar-nav navbar-right">
<div ng-include="AnnonymousTopHeaderUrl"></div>
</ul>
</div>
AnnonymousNavigation.html内容
<li>
<a target="_self" href="#Register">Register</a>
</li>
基本控制器在这里
myApp.controller("BaseController", ["$scope", function($scope) {
$scope.AnnonymousTopHeaderUrl = "App/Include/AnnonymousNavigation.html";
}]);
当我运行代码时,它显示在Html下面
<ul class="nav navbar-nav navbar-right">
<!-- ngInclude: AnnonymousTopHeaderUrl -->
<div ng-include="AnnonymousTopHeaderUrl" class="ng-scope">
<li class="ng-scope">
<a target="_self" href="#Register">Register</a>
</li>
</div>
</ul>
我期待低于Html
<ul class="nav navbar-nav navbar-right">
<li>
<a target="_self" href="#Register">Register</a>
</li>
</ul>
有没有办法获得预期的Html?
答案 0 :(得分:0)
您应该将ng-include
指示放在ul
元素上,这样它就不会在div
内创建不必要的ul
元素。
<div class="collapse navbar-collapse" id="app-navbar-collapse">
<ul class="nav navbar-nav navbar-right" ng-include="AnnonymousTopHeaderUrl">
</ul>
</div>