如何在angularjs ng-view中隐藏索引页面的内容

时间:2021-11-29 00:09:23

I am trying to find whether I can hide the parent file contents when accessing a partial(view) in angularJs. Here is my problem:
I have my parent page (index page) with contents like menubar, footer and some other stuff which will be displayed in all the pages in my product. I have included ng-view in between the stuff and the footer. Now, in a particular page, I don't want to show this menubar, footer. I need to show only that particular stuff which is present in the partial. So, I need to hide the menubar, footer and all other stuff which is from parent scope. Is it possible to do it with angularJS?

我试图找到在angularJs中访问局部(视图)时是否可以隐藏父文件内容。这是我的问题:我的父页面(索引页面)包含菜单栏,页脚和其他一些内容,这些内容将显示在我产品的所有页面中。我在内容和页脚之间包含了ng-view。现在,在一个特定的页面中,我不想显示这个菜单栏,页脚。我只需要显示部分中存在的特定内容。所以,我需要隐藏菜单栏,页脚和来自父作用域的所有其他内容。是否可以使用angularJS进行操作?

Thanks in advance!

提前致谢!

1 个解决方案

#1


2  

you can set a $rootScope variable that says whether to display menu or not (according the route)

你可以设置一个$ rootScope变量来说明是否要显示菜单(根据路线)

// particular route controller
$rootScope.hideMenu = true;

and then in the markup add

然后在标记添加

ng-hide="hideMenu"

to any element you want not to display

到你想要不显示的任何元素

#1


2  

you can set a $rootScope variable that says whether to display menu or not (according the route)

你可以设置一个$ rootScope变量来说明是否要显示菜单(根据路线)

// particular route controller
$rootScope.hideMenu = true;

and then in the markup add

然后在标记添加

ng-hide="hideMenu"

to any element you want not to display

到你想要不显示的任何元素