Angularjs 在angular js中隐藏特定控制器中的内容

Angularjs 在angular js中隐藏特定控制器中的内容,angularjs,controllers,Angularjs,Controllers,在我的网站中,我在索引页面(索引控制器)中有导航栏。当我单击登录按钮时,状态和控制器将更改为登录控制器。我想在登录控制器中隐藏导航栏 我不想基于状态更改或路由更改隐藏导航栏。我想在登录控制器中隐藏导航栏 请帮忙。提前谢谢。在angular中,您可以通过各种方式隐藏内容,例如: <div ng-if="showMe">shown if showMe true</div> ( creates subscope, not visible in dom) <div ng-h

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

我不想基于状态更改或路由更改隐藏导航栏。我想在登录控制器中隐藏导航栏


请帮忙。提前谢谢。

在angular中,您可以通过各种方式隐藏内容,例如:

<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>
如果showMe为true则显示(创建子范围,在dom中不可见)
如果hideMe为true则隐藏(无子范围,在dom中可见,但对用户不可见)
如果hideMe为true则隐藏(无子范围,仅添加带有display的类:none;property
将样式添加到hideMe,如hideMe='{display:none}',该样式将嵌入到内联样式中

我没有其他想法……

Javascript

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

<div ng-hide="contentShow">Content</div>
内容

什么类型的内容?请包括一些相关的代码,并在代码的支持下更具体地说明您试图实现的目标。使用
ng hide
在特定控制器中隐藏特定内容以隐藏特定内容