init commit
This commit is contained in:
commit
5b7c7d4d19
25 changed files with 8503 additions and 0 deletions
53
src/app/step.component.ts
Normal file
53
src/app/step.component.ts
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
import { Component, OnInit, Input } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-step',
|
||||
template: `
|
||||
<div class="step">
|
||||
|
||||
<h2>{{ step.prompt }}</h2>
|
||||
|
||||
<div *ngFor="let field of step.fields" [ngSwitch]="field.type">
|
||||
|
||||
<app-text *ngSwitchCase="'text'"
|
||||
|
||||
[field]="field"
|
||||
(update)="update()"
|
||||
|
||||
></app-text>
|
||||
|
||||
<app-radio *ngSwitchCase="'radio'"
|
||||
|
||||
[field]="field"
|
||||
(update)="update()"
|
||||
|
||||
></app-radio>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
`
|
||||
})
|
||||
export class StepComponent implements OnInit {
|
||||
|
||||
@Input() step: Step;
|
||||
|
||||
ngOnInit() { console.log("Step", this.step); }
|
||||
|
||||
update() {
|
||||
|
||||
console.log(this.step.fields);
|
||||
|
||||
/* Check for completeness */
|
||||
for (let field of this.step.fields) {
|
||||
if (!field.ok) {
|
||||
this.step.ok = false;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
this.step.ok = true;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in a new issue