Skip to content

Use remove component method #664

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Dec 31, 2017
10 changes: 3 additions & 7 deletions src/lib/utils/options/sources/component.ts
Original file line number Diff line number Diff line change
@@ -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);
}
@@ -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);
}
}