基于angular的组件递归

//html
{{val.name}}
//ts import { Component, OnInit,Input } from '@angular/core'; @Component({ selector: 'app-list', templateUrl: './list.component.html', styleUrls: ['./list.component.css'] }) export class ListComponent implements OnInit { @Input() data=[ {name:'t'}, {name:'t1',children:[ {name:'t11'}, {name:'t12'} ]}, {name:'t2'} ] constructor() { } ngOnInit() { } }

你可能感兴趣的:(angular6)