Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/26.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ionic-framework/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angular 离子5离子标签隐藏在某些特定页面中_Angular_Ionic Framework_Components_Show Hide_Ionic Tabs - Fatal编程技术网

Angular 离子5离子标签隐藏在某些特定页面中

Angular 离子5离子标签隐藏在某些特定页面中,angular,ionic-framework,components,show-hide,ionic-tabs,Angular,Ionic Framework,Components,Show Hide,Ionic Tabs,我已经创建了选项卡页面,并通过选择器将其包含在app.component.html文件中。我的问题是,我想在某些特定页面中隐藏选项卡。有人能帮我吗。下面我将分享我创建的标签页代码 tab.page.html 家 搜寻 咔哒声 轮廓 app.component.html 什么是“页面”?若您指的是特定的路由,那个么您可以订阅并在App component controller中设置一个布尔标志 应用程序组件.ts 从'@angular/Router'导入{NavigationEnd,Rout

我已经创建了选项卡页面,并通过选择器将其包含在app.component.html文件中。我的问题是,我想在某些特定页面中隐藏选项卡。有人能帮我吗。下面我将分享我创建的标签页代码

tab.page.html


家
搜寻
咔哒声
轮廓
app.component.html


什么是“页面”?若您指的是特定的路由,那个么您可以订阅并在App component controller中设置一个布尔标志

应用程序组件.ts

从'@angular/Router'导入{NavigationEnd,Router};
从'rxjs'导入{Subject};
从“rxjs/operators”导入{takeUntil,filter};
导出类AppComponent实现OnInit、OnDestroy{
已关闭$=新主题();
showtab=true;//e导航结束的实例),
takeUntil(此.closed$)
).订阅(事件=>{
如果(事件['url']=='/somePage'){

this.showTabs=false;//不!它不起作用。在指定if条件下的路由器@michaelWhat是指if条件下的路由器?if条件在路由器中,而不是相反。而且您还没有清除“页面”是什么意思。你是指特定路线吗?当我单击任何选项卡按钮时,例如“配置文件”按钮,我设计的任何内容都是我的配置文件页面,在配置文件页面中有一个按钮是我定义为“设置”的,因此当我单击“设置”时,将显示“设置”页面,因此我想在设置页面中隐藏我的离子选项卡。如果(事件['url']=='/settings'),这是关于if条件下的路由器@MichaelThs.closed$)
中有一个打字错误。它应该是
takeUntil(this.closed$)
。我已经编辑了答案。这是你的问题吗?请注意条件
事件['url']=='/settings'
仅在它不接受任何参数(如
/settings/someParam
)时才起作用。在这种情况下,您只能检查
设置
字符串是否存在于带有
事件['url']的路由中。indexOf('settings')!=-1