-
Notifications
You must be signed in to change notification settings - Fork 98
/
enable-back-links.directive.ts
52 lines (49 loc) · 1.31 KB
/
enable-back-links.directive.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import {Directive, EventEmitter, Host, OnInit, Output} from '@angular/core';
import {MovingDirection} from '../util/moving-direction.enum';
import {WizardCompletionStep} from '../util/wizard-completion-step.interface';
/**
* The `awEnableBackLinks` directive can be used to allow the user to leave a [[WizardCompletionStep]] after is has been entered.
*
* ### Syntax
*
* ```html
* <aw-wizard-completion-step awEnableBackLinks (stepExit)="exit function">
* ...
* </aw-wizard-completion-step>
* ```
*
* ### Example
*
* ```html
* <aw-wizard-completion-step stepTitle="Final step" awEnableBackLinks>
* ...
* </aw-wizard-completion-step>
* ```
*
* @author Marc Arndt
*/
@Directive({
selector: '[awEnableBackLinks]'
})
export class EnableBackLinksDirective implements OnInit {
/**
* This EventEmitter is called when the step is exited.
* The bound method can be used to do cleanup work.
*/
@Output()
public stepExit = new EventEmitter<MovingDirection>();
/**
* Constructor
*
* @param completionStep The wizard completion step, which should be exitable
*/
constructor(@Host() private completionStep: WizardCompletionStep) {
}
/**
* Initialization work
*/
public ngOnInit(): void {
this.completionStep.canExit = true;
this.completionStep.stepExit = this.stepExit;
}
}