如何在angular2中的布局中访问其他页面中的布局数据

时间:2017-12-25 06:39:06

标签: angular typescript

我的路线如下

{path:'',component:MenuComponent, outlet: 'menu'} ,


{path:'',redirectTo:'/',pathMatch:'full'},


{path:'',component:HomeComponent},
{path:':section',component:ListingComponent}

app.component.html如下

<div class="slider-panel"><router-outlet></router-outlet></div>
<router-outlet name="menu"></router-outlet>

如何访问listingcomponent中的菜单数据和菜单中的列表数据。

我提到https://developer.android.com/reference/android/content/ClipboardManager.html并编辑了我的孩子,如下所示                  从中导入{Component,OnInit,Provider,HostListener,Input}                  &#39; @角/核心&#39 ;;

              import{MenuComponent} from 
               '../shared/layout/footer/menu.component';

             export class SectionBasedListingComponent implements OnInit {
               @Input('menus') menu:Array<Menu>;
              ngOnInit()
             {
               console.log(this.menu);
             }
           }

我的父组件是

                import { Component, OnInit, Provider, ViewChild, 
                ElementRef } from '@angular/core';
                export class  MenuComponent implements OnInit
                {
                public _menus: Array<Menu> = [];
                  ngOnInit() {
                this._service.GetRegionWiseMenu("3").
               subscribe(
               res => {

                   this._menus = res;
                });
               }
                }

未定义为this.menu的输出

感谢

0 个答案:

没有答案