ensure @Input bindings are not undefined before executing trigger logic

This commit is contained in:
alecmerdler 2017-05-26 11:50:11 -07:00
parent 4750d1c5ef
commit d5e35156e0
6 changed files with 64 additions and 53 deletions

View file

@ -24,7 +24,7 @@ export class LinearWorkflowSectionComponent implements OnChanges, OnInit {
constructor(@Host() @Inject(LinearWorkflowComponent) private parent: LinearWorkflowComponent) {
}
public ngOnInit(): void {
if (!this.skipSection) {
this.parent.addSection(this);
@ -34,7 +34,7 @@ export class LinearWorkflowSectionComponent implements OnChanges, OnInit {
public ngOnChanges(changes: SimpleChanges): void {
switch (Object.keys(changes)[0]) {
case 'sectionValid':
if (!changes['sectionValid'].currentValue && this.parent) {
if (changes['sectionValid'].previousValue && !changes['sectionValid'].currentValue && this.parent) {
this.parent.onSectionInvalid(this.sectionId);
}
break;