2016-12-21 44 views
-1

在我的网站中,我在索引页(索引控制器)中有导航栏。当我单击登录按钮时,状态和控制器将更改为登录控制器。我想隐藏登录控制器中的导航栏。以角度js隐藏特定控制器中的内容

我不想隐藏基于状态变化或路线变化的导航栏。我想隐藏登录控制器控制器中的导航栏。

请问您能否提前帮忙。

+0

什么样的内容?请包含一些相关的代码,并更具体地说明您的代码所支持的内容。 – devqon

+0

在特定控制器中为您的特定内容使用'ng-hide'以隐藏特定内容 –

回答

1

在角可以隐藏例如以各种方式内容:

<div ng-if="showMe">shown if showMe true</div> (creates subscope, not visible in dom) 
<div ng-hide="hideMe">hidden if hideMe true</div> (no subscope, visible in dom, but not visible for user) 
<div ng-class="{'displayNoneClass': hideMe}"> hidden if hideMe true</div> (no subscope, adding just class with display: none; property 
<div ng-style="hideMe"> add style to hideMe like hideMe='{display: none}' which will be embedded into inline style</div> 

我没有别的想法......

0

的Javascript

var pages = ['/']; 
$rootScope.$on('$locationChangeSuccess', function() { 
    var $$route = $route.current.$$route; 
    $scope.contentShow = $$route && pages.indexOf($$route.originalPath) < 0; 
}); 

HTML

<div ng-hide="contentShow">Content</div> 
相关问题