app-routing TS
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import {NextlinkComponent} from './nextlink/nextlink.component';
import {ChildComponent} from './child/child.component';
const routes: Routes = [
{path: '', component: ChildComponent},
{path: 'nextlink', component: NextlinkComponent},
];
@NgModule({
imports: [RouterModule.forRoot(routes)],
exports: [RouterModule]
})
export class AppRoutingModule { }
app HTML
<div class="wrapper">
<h2>我是父组件</h2>
<div>这个div定义在父组件中</div>
<app-child>
<div class="header">这个div是父组件投影到子组件的1, {
{title}}</div>
<div class="footer">这个div是父组件投影到子组件的2</div>
</app-child>
</div>
<div [innerHTML] =