使用ng内容

时间:2018-03-31 17:56:58

标签: javascript angular typescript

我想在循环中重复ng-content,如下所示:

@Component({
  selector: 'app-card',
  template: `
     <div *ngFor="let x of [1,2,3,4,5,6]">
       {{x}} <ng-content></ng-content>
     </div>
`
})

我在以下内容中调用该组件:

@Component({
  selector: 'app-card-with-options',
  template: `
     <app-product>
       <input type="submit" min="1">
     </app-product>
`
})

结果显示只有onc输入按钮,我希望它返回6.为什么它不显示6?

0 个答案:

没有答案