我正在尝试解决如何使用Material 2 sidenav#rightNav
从子组件模板单击事件中触发父组件模板中的本地引用。我想我需要使用注释,但不知道如何。(click)="rightNav.open()"
@ViewChild
子组件模板(app-conditions-list):
<div *ngFor="let condition of conditions" [class.selected]="condition === selectedCondition"
(click)="rightNav.open()"></div>
父组件模板(条件组件):
import { Component} from '@angular/core';
import { ConditionsListComponent } from './listComponent/conditions-list.component';
@Component({
moduleId: module.id,
selector: 'app-conditions',
template: `
<md-sidenav #rightNav align="end" mode="side">
"Condition details will open here on click event"
</md-sidenav>
<app-conditions-list></app-conditions-list>`,
styleUrls: ['./conditions.component.css'],
directives: [
ConditionsListComponent,
]
})
export class ConditionsComponent {
title = "Conditions Manager"
}
子组件嵌套在父组件模板中。谢谢!