一、在父子组件中,子组件通过属性接收父组件传递过来的参数
<app-header [title]="title" ></app-header>
二、子组件中引入Input模块
import { Component, OnInit,Input } from '@angular/core';
三、注册模块
export class HeaderComponent implements OnInit {@Input() title:stringconstructor() { }ngOnInit() {}}
四、使用
<h1>{{title}}</h1>
