点击添加按钮增加一个组件

父组件html:


  

  

父组件ts:

articles: Article[];
  all: any[] = [{}];
add() {
    this.all.push({});
  }

子组件html:

 
标题

子组件ts:

 @Input() article: Article;

article.model.ts

export class Article {
    votes: number;
    title: string;
    link: string;
}

你可能感兴趣的:(点击添加按钮增加一个组件)