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
Ivy: Input fields inherited from abstract class cause runtime exception #32428
Comments
Hi @AndrewKushnir, Tried adding @Directive()
export abstract class BaseEditFormComponent {
@Input() itemId?: number;
} But then my app won't start due to this error :/
Not sure if that is relevant, but I do have dependencies injected into my component which are passed to base class via |
Hi @Enngage, I tried to reproduce the problem locally, but failed. Here is my TestBed test (which is passing):
Could you please have a look at the test and let me know how it should be changed to better mimic your use-case and repro the problem? Thank you. |
I have the same problem (in our giant codebase with lots of abstract component classes) Not sure why the testbed above works, but this is my simplest possible reproduction: Using @angular/cli@next I do an ng new and then: app.component.ts
car.component.ts
app.module.ts
And then run
|
This was resolved in #33131 :D |
@AndrewKushnir, thanks! Yeah, that indeed fixed the issue I initially raised but wasn't able to easily reproduce due to the huge code base I have. Though it raised another issue. I'm looking at https://next.angular.io/guide/migration-undecorated-classes which explains the change and it makes sense. However, the compiler failes with
If you have a constructor with dependencies that cannot be resolved. In my case I have constructor in my abstract class like:
I'm guessing that ignoring that property would work? Is there a way to ignore it? Edit: Seems like using |
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. |
Hey,
Just tried
9.0.0-next.4
and it seems that when you have an abstract component class:And then you inherit it by specific components:
And use it like:
You get runtime exception such as
Adding
itemId
property toEditFormComponent
component fixes the issue and app runs as expected.Is such behavior expected?
🌍 Your Environment
Angular Version:
The text was updated successfully, but these errors were encountered: