-
Notifications
You must be signed in to change notification settings - Fork 25.3k
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
Extending pipes cause template parse errors #8694
Comments
The relevant files in the plunker are
|
I'm also experiencing this issue. I have an stranslate pipe class derived from a translate pipe class. |
More information, as I start to think it might become relevant. I'm using ES5. I think I've found out more or less what's going on. While we're inside metadata_resolver's getPipeMetadata, we call into getTypeMetadata, which calls into the reflection system. The reflection system runs the following two lines:
The first line works fine, paramAnnotations is correct. The reflector finds that metadata exists for the property 'parameters' for typeOrFunc (my subclass constructor). It returns an array of three arrays, each length one containing a constructor, one for each class which should have an instance injected. The second line is unable to find metadata for my constructor, but does find metadata for its parent. I don't yet understand why this step is being done. Then the types and the the annotations are "zipped" and the non-matching data is discarded, rendering the state internally consistent even though it wasn't. |
I was able to find a workaround. Ugly but it works.
|
I'm now confident that the root cause of my issue is extending an es6 pipe using es5 annotation methods. |
@mhevery any activities for this problem? |
Could some quickly describe:
|
Expected behavior: Current behavior (??? could be fixed by now I'm not using A2 at the moment and the original plunk seems to be broken): The code will error out because the child class, with different constructor parameters, will be injected with types based on the parent constructor's signature. Steps to reproduce: In a working app, define a pipe using
The parent class constructor is defined as Its constructor injection information is used, and a single ChangeDetectorRef is injected into ProblemPipe and assigned to _myParam. Pipe cannot be constructed because it is passed null. |
thanks for the details. |
Not at present. |
I created a repro. http://plnkr.co/edit/zW5eP9oxI3e3pDwwNsFv |
Thanks! I've edited your repro to what I believe should show the issue, but for some reason this code is failing before it gets to the injection phase. Maybe you know what's going on? |
OK I've updated that plunk further to the point where it is clear that the issue as described is no longer occurring. For some reason my class which extends AsyncPipe isn't working, but the extended class is certainly being injected correctly. |
Ah, I needed to make it pure since the new Pipe metadata overwrites the original. |
Close it up! |
I also just looked back at the original plunk by the bug creator. His issue isn't quite the same as the one I was having, but I think I suspect his problem was, like mine at the very end, that he should have added pure to his pipe's metadata. |
@conartist6 I don't think a template parse error is related to |
Yeah I've tested the repro on the plunker with |
Here is an updated repro : http://plnkr.co/edit/YNLNieCDw8Qb90TsovQr?p=preview @vicb let me know if I should just open a new issue for this |
@chrisnicola thanks - I'll update the description with your plunker & some analysis |
relates to #11606 |
#11606 was merged so this can be closed @pkozlowski-opensource |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
IMPORTANT: This repository's issues are reserved for feature requests and bug reports. Do not submit support requests here, see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question.
Steps to reproduce and a minimal demo of the problem
Visit this plunker and bring up the developer tools to see the errors being logged to the console:
http://plnkr.co/edit/HKRTePVCqumMGAeqeyPj?p=preview
I have a CustomDataPipe defined that extends the DatePipe. When updating the rc1, I started receiving console errors about not being able to find the custom pipe. This was working in 2.0.0-beta.17.
Current behavior
Extending pipes are causing template parse errors.
Expected/desired behavior
Should be allowed to extend pipes.
Other information
Update 2016.10.03
See http://plnkr.co/edit/YNLNieCDw8Qb90TsovQr?p=preview from @chrisnicola
The problem is that the
cad
pipe override the definition ofCurrencyPipe
cad
Pipe is not found,currency
in the plunker, thecad
pipe is used,The text was updated successfully, but these errors were encountered: