我的路线如下
{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的输出
感谢