例如我有下一个HTML:
<div *ngFor="let integration of integrations | objKeys">
<h4 (click)="toggleVisibleForIntegration(integration.key)" #integr>
{{visibleForIntegration.get(integration.key) ? '▼' : '▶'}} {{integration.value.name}}
</h4>
<div *ngIf="visibleForIntegration.get(integration.key)">
<div *ngFor="let scenario of integration.value.scenarios | objKeys">
<p (click)="toggleVisibleForScenario(integration.key, scenario.key)">
{{visibleForIntegrationScenarioWraper(integration, scenario) ? '▼' : '▶'}} {{scenario.value.name}}
</p>
<p>
<app-schema-form
#schem
[id] = "integration.key"
*ngIf="visibleForIntegrationScenarioWraper(integration, scenario)"
[schema]="pojoMapWrapper(scenario)"
[layout]="layout"
[options]="options"
(onSubmit)="executeScenario($event)">
</app-schema-form>
</p>
</div>
</div>
</div>
我想知道是否有一种方法标记angular2-json-schema-form,然后在组件中获取id?从我上面发布的代码看,我有几个<app-schema-form></app-schema-form>
,我需要在组件中选择它们(包含数据和模式),但我不知道。我读到了FormGroup和ViewChildren,但我不知道如何区分从其他选择的<app-schema-form></app-schema-form>
。
我很感激您的建议。