Angular 替换为角度输入中的插值

Angular 替换为角度输入中的插值,angular,Angular,我迭代一个数组,每次都显示一个角度分量 <div *ngFor="let category of categories; let i=index" id="category_{{i}}"> <app-category [inputId]="'category_'[i]" </app-category> </div> app-cateogry.html <!--Some html --> <div *n

我迭代一个数组,每次都显示一个角度分量

<div *ngFor="let category of categories; let i=index" id="category_{{i}}">
 <app-category
          [inputId]="'category_'[i]"
  </app-category>
</div>
app-cateogry.html

<!--Some html -->
    <div *ngFor="let subCategory of subCategories; let i=index" id="subCategory_{{i}}">
     <app-category
              [inputId]="'category_'[i]"
      </app-category>
    </div>

您可以按如下方式使用:

[inputId]="{{'category_'+ i}}"
您可以按如下方式使用:

[inputId]="{{'category_'+ i}}"

这是解决方案
[inputId]=“'category_'+i”
;您不能对输入使用插值,因此我将字符串“category”与索引连接起来,这是解决方案
[inputId]=“category”+I”
;您不能对输入使用插值,因此我将字符串“category”与索引连接起来。

inputId=“category{{I}}”
您将在中找到答案。
inputId=“category{I}”
您将在中找到答案。