【发布时间】:2020-08-20 01:17:10
【问题描述】:
我创建了一个名为 Wizard 的组件,它有两个属性:Sections & Steps
这是组件的摘录
import { Component, Input, OnInit } from '@angular/core';
import { Section } from './models/section';
import { Step } from './models/step';
@
Component({
styleUrls: ['wizard.component.css'],
selector: 'sym-wizard',
templateUrl: './wizard.component.html'
})
export class WizardComponent implements OnInit {
@Input() sections: Section[];
@Input() steps: Step[];
currentStep: Step;
constructor() {
}
}
如何从 HTML 视图中填充属性,以便以下内容填充部分和步骤属性?
<sym-wizard>
<sections>
<section name="name1"></section>
<section name="name2"></section>
<section name="name3"></section>
</sections>
<steps>
<step name="step1" section="name1">
</step>
<step name="step2" section="name1"></step>
<step name="step3" section="name2"></step>
</steps>
</sym-wizard>
【问题讨论】:
标签: angular typescript angular-components