Impossibile rimuovere i componenti dinamici in ionic-2. Si dice eccezione mentre compila dattiloscrittoIl tipo generico 'ComponentRef <C>' richiede 1 tipo argomento (i)
“Generic type 'ComponentRef' requires 1 type argument(s)”.
Inoltre, lo stesso codice funziona mentre si utilizza senza utilizzare ionic2. Apprezzo molto il tuo aiuto. Grazie in anticipo.
class DynamicCmp {
_ref: ComponentRef;
_idx: number;
constructor(private resolver: ComponentResolver, private location: ViewContainerRef) { }
remove() {
this._ref.destroy();
}
add1() {
this.resolver.resolveComponent(DynamicCmp).then((factory: ComponentFactory<any>) => {
let ref = this.location.createComponent(factory, 0);
ref.instance._ref = ref;
ref.instance._idx = this._idx++;
});
}
}
Exception: TypeScript error: ....../home/home.ts(9,11): Erro r TS2314: Generic type 'ComponentRef' requires 1 type argument(s).
o 'DynamicComp' –
Grazie mille. Sta lavorando adesso. – user2932411