一、给子组件一个名称
<app-content #content></app-content>
...
export class ContentComponent implements OnInit {
public msg:string = "我是你孩儿"
}
二、父组件中配置
import { Component,ViewChild } from '@angular/core';
...
export class AppComponent {
@ViewChild('content',{static:false}) content:any;
}
..
<p>{{content.msg}}</p>