1
我是AngularJS的新手。 如何使用Angularjs動態顯示麪包屑?如何使用Angularjs顯示麪包屑痕跡
我的網址是:http://localhost/letsTravel/#/our-offer
, 所以我的痕跡應該顯示'我們的報價'。
如果網址是:http://localhost/letsTravel/#/
, 麪包屑應該隱藏。
HTML的痕跡在裏面頭標記:
<header>
<div>
<nav class="breadcrumbs" ng-controller="breadcrumController" >
<a href="#/" >Home</a> →
<span>Our offer</span>
</nav>
</div>
</header>
你可以動態顯示或與'NG-if'或'隱藏你的痕跡納克「顯示」指令。您可能已經用於麪包屑內容的'$ location'服務會告訴您您是否處於上下文根目錄。 – Aaron
@Aaron'app.controller( 'BreadcrumCtrl',函數($位置$範圍){ \t的console.log($位置); \t $ scope.path = $ $$位置路徑; \t }) ;'' ' 我正在使用上面的代碼。但是當我的網址更改**「$ location。$$ path」時,** {{path}} **保持不變。它會改變當我重新加載頁面 – angularjsBeginner
@Aaron你可以請指導我如何改變動態名稱在麪包動態 – angularjsBeginner