Skip to content

Commit

Permalink
Use remove component method (#664)
Browse files Browse the repository at this point in the history
use removeComponent method on component removed
  • Loading branch information
aciccarello committed Dec 31, 2017
1 parent eb7c305 commit e9b866e
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/lib/utils/options/sources/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,9 @@ export class ComponentSource extends OptionsComponent {
}

private removeComponent(component: AbstractComponent<any>) {
const name = component.componentName;
let index = this.knownComponents.indexOf(name);
let index = this.knownComponents.indexOf(component.componentName);
if (index !== -1) {
this.knownComponents.slice(index, 1);
this.knownComponents.splice(index, 1);
for (let declaration of component.getOptionDeclarations()) {
this.owner.removeDeclarationByName(declaration.name);
}
Expand All @@ -56,9 +55,6 @@ export class ComponentSource extends OptionsComponent {
}

private onComponentRemoved(e: ComponentEvent) {
const declarations = e.component.getOptionDeclarations();
for (let declaration of declarations) {
this.owner.removeDeclarationByName(declaration.name);
}
this.removeComponent(e.component);
}
}

0 comments on commit e9b866e

Please sign in to comment.