I need to implement wizard in angular2. And I have a idea but I dn't know how to implement. This is my idea:
I want create one component
, it will be common component. With steps and Next/Back button. Like this
@Component({
selector: 'div',
providers: [],
template: ' <ul class="steps">
<li *ngFor="#step of steps; #i = index" class="steps-item">
<a href="#" class="steps-link" [attr.value]="step.value">{{step.name}}</a>
</li>
</ul>
<form >
<template></template>
<div>
<button type="button">Back</button>
<button type="submit">Submit</button>
</div>
</form>',
pipes: [TranslatePipe],
directives: []
})
export class WizardComponent {
steps: any;
constructor() {
this.steps = [
{'name': 'step 1', 'value': '1'},
{'name': 'step 2', 'value': '2'},
{'name': 'step 3', 'value': '3'}
];
}
}
And then every component will extend form WizardComponent
, to re-use all HTMl and next/back function. Something like that.
Any solution for me, thanks.