Angular-单击事件中的ActivatedRoute

问题描述

我正在使用ActivatedRoute来将汇总表从一个组件调用到另一组件,并且我在下面添加了以下内容:我无法在点击事件中获得预期的汇总表

tab-routing.module.ts

import { NgModule } from '@angular/core';
import { Routes,RouterModule } from '@angular/router';
import { TABMasterComponent } from '../tabs/tab-master/tab-master.component';


const routes: Routes = [
  { path: "tabmasters",component: TABMasterComponent,loadChildren:'../tabs/tab-master/tab-master.component',data:{
       istab : false
     }
     },];

@NgModule({
  imports: [RouterModule.forRoot(routes)],exports: [RouterModule]
})
export class AppRoutingModule { } 

tabmasters.component.ts

istab = false;


constructor(private fb: FormBuilder,private router: Router,private toastr:ToastrService,private route:ActivatedRoute) {
      this.istab = this.route.snapshot.data.istab;
      console.log('here',this.route.snapshot.data)
      }

tabmaster.component.html

<div *ngIf="iscontrol">
        <div class="table-responsive">
            <table class="table">
                <thead class="table_header">
                    <tr>
                        <th>Name</th>
                    </tr>
                </thead>
                <tbody>
                    <tr *ngFor="let cl of ClList;">
                        <td>{{ cl.name}}</td>
                    </tr>
                </tbody>
            </table>
         </div>
</div>
<div *ngIf="istab">
        <div class="table-responsive">
            <table class="table">
                <thead class="table_header">
                    <tr>
                        <th>Name</th>
                    </tr>
                </thead>
                <tbody>
                    <tr *ngFor="let tab of tabList;">
                        <td>{{ tab.name}}</td>
                    </tr>
                </tbody>
            </table>
         </div>
</div>


当我在应用程序组件中使用click事件时,我想显示istab摘要。但我面临的问题是,以上两个表格都在选项卡组件中,我只想在点击事件中显示istab摘要

TAB1----isctrl summary              TAB2-----istab summary                   

如果我单击boolean tab 1 isctrltrue istab,并且如果我单击false { {1}}是tab2,而istatrue

以上两个摘要位于isctrl中,用于显示引导导航标签,如下面的标签

bootstrap tabs

我的 app.component.HTML 就像

false

和我的 app.component.TS 就像

tabcomponent

我想转到应用程序组件中click事件中的摘要表。正常的路由器链接正常工作,但是我想获取tab2中的摘要,我使用的另一种发射方法却不起作用。如何对此使用<button (click)="gotoTabsUMMARY()"></button>

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...