Skip to content
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

Component inheritance and @ViewChildren or @ContentChildren: "Uncaught Error: useExisting is unimplemented" #219

Open
giancarlo-dm opened this issue Apr 11, 2018 · 0 comments

Comments

@giancarlo-dm
Copy link

Hello,

First I appreciate the hardwork you guys had put on this project.

The problem:

I was trying to implement a use case similar to this stackoverflow question, but when I tried to use the provider declaration: providers: [{provide: BaseComponent, useExisting: forwardRef(() => ChildComponent2) }], I got the following error on the console:

Uncaught Error: useExisting is unimplemented
    at resolveReflectiveProvider (modules.js?hash=30556e0263a3949b7bc00058f573ce0b4384bd92:62054)
    at modules.js?hash=30556e0263a3949b7bc00058f573ce0b4384bd92:62121
    at Array.forEach (<anonymous>)
    at Object._normalizeProviders (modules.js?hash=30556e0263a3949b7bc00058f573ce0b4384bd92:62111)
    at _bundleComponent (modules.js?hash=30556e0263a3949b7bc00058f573ce0b4384bd92:62379)
    at modules.js?hash=30556e0263a3949b7bc00058f573ce0b4384bd92:62402
    at Array.forEach (<anonymous>)
    at bundle (modules.js?hash=30556e0263a3949b7bc00058f573ce0b4384bd92:62401)
    at modules.js?hash=30556e0263a3949b7bc00058f573ce0b4384bd92:62429
    at Array.forEach (<anonymous>)

So I browsered the source code and found this at src/core/di/reflective_provider.ts:

if (provider.useExisting) {
    const [name,value] = provide( provider.useExisting );
    const method = 'factory';

    throw new Error('useExisting is unimplemented');
    // target = (v) => v;
    // annotate(target, 'factory', {name});
    // annotate(target, 'inject', [toInjectorName(provider.useExisting)]);
  }

The questions:

Was it too hard to backport this functionality or it was just forgotten to implement?

Is there an workaround (or correct way of doing this), that is similar to the stackoverflow example I gave?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant