4

I've upgraded my Angular version from 8 to 9 and now creating components dynamically doesn't work anymore. I used this function to iterate through all the components and find the right component to create by it's selector:

 private getComponentClassFromSelector(componentFactoryResolver, selector) {
        let result;
        componentFactoryResolver._factories.forEach((val, key) => {
            if (val.selector === selector) {
                result = key;
            }
        });
        if (!result) {
            result = this.getComponentClassFromSelector(componentFactoryResolver._parent, selector);
        }
        return result;
    }

what alternatives I have because now I can't iterate componentFactoryResolver._factories as it doesn't exist anymore?

0 Answers0