Fix a transition initilization after deleting a subcategory

This commit is contained in:
Konstantinos Triantafyllou 2022-09-08 15:10:01 +03:00
parent 3d6cbf8b3e
commit c1bc7b6a5a
1 changed files with 4 additions and 4 deletions

View File

@ -460,15 +460,15 @@ export class TopicComponent implements OnInit, OnDestroy, IDeactivateComponent {
this.subCategoryIndexSubject.next(subcategoryIndex); this.subCategoryIndexSubject.next(subcategoryIndex);
} }
subCategoryChanged(callback: Function, save: boolean = false) { subCategoryChanged(callback: Function) {
if(this.subCategories && save) { if(this.subCategories) {
this.subCategories.disable(); this.subCategories.disable();
} }
if(callback) { if(callback) {
callback(); callback();
} }
this.cdr.detectChanges(); this.cdr.detectChanges();
if(this.subCategories && save) { if(this.subCategories) {
this.subCategories.init(); this.subCategories.init();
this.subCategories.enable(); this.subCategories.enable();
} }
@ -527,7 +527,7 @@ export class TopicComponent implements OnInit, OnDestroy, IDeactivateComponent {
} else { } else {
this.stakeholder.topics[this.topicIndex].categories[this.categoryIndex].subCategories[this.index] = HelperFunctions.copy(subCategory); this.stakeholder.topics[this.topicIndex].categories[this.categoryIndex].subCategories[this.index] = HelperFunctions.copy(subCategory);
} }
}, true); });
}; };
if (this.index === -1) { if (this.index === -1) {
this.save('Subcategory has been successfully created', path, this.form.value, callback); this.save('Subcategory has been successfully created', path, this.form.value, callback);