-
Notifications
You must be signed in to change notification settings - Fork 263
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
Make component methods protected to support Component inheritance #1505
Comments
@JonnyHeavey I think is a good idea. In this way, we can take advantage of the new inheritance introduced in the Angular version 2.3. I think we will prioritize this refactoring and modify the visibility. |
I had a look at the component inheritance in v2.3 just before Christmas, and something to bear in mind is that the component annotations can't be inherited (and won't be if this comment anything to go by: angular/angular#7968 (comment) ). This massively reduces the usefulness of inheritance and extensions as, as far as I can tell, the template needs duplicating in the extending widgets. |
@davidcognite you are correct about the annotations. I still think there is value in being able to extend a component though, even if you have to duplicate the template/styles, as you would be saved from the duplication of the component logic. |
@davidcognite Could you please raise separate tickets for the issues you came across or would like to see improved? We could start eliminating the need for inheritance/subclassing for your concrete scenarios. So addressing "why" instead of discussing "how", where it is technically feasible of course. Thanks in advance. |
Additional information on inheritance in 2.3: Component Inheritance in Angular 2 |
@JonnyHeavey, I am interested in the customization that you need to add to the upload button. I wondering if is a scenario that would interest also to us. |
@eromano Currently I am looking to add some additional form fields (to capture some metadata) + custom validation to the upload process, and so want the ability to control when the upload starts. I believe that the current implementation starts the upload automatically. That is my current requirement, but this feature suggestion was more broad than that - I think that the ability to extend components will be useful for many requirements. |
Depends on #1522 |
Type of issue: (check with "[x]")
New feature request:
In version 2.3 Angular added component inheritance. I wondered whether it would be possible to the component methods protected (instead of private) where suitable, allowing us to extend the components to more easily customise behaviour.
For example, the
UploadButtonComponent
does much of what I need it do, but I would like to slightly change the logic around when to upload the file. With the current implementation, I would have to create my own button component and use theUploadService
from scratch, and repeat much of the code already found withinUploadButtonComponent
. If functions such asuploadFiles
were protected instead of private, I wouldn't need to do this.The text was updated successfully, but these errors were encountered: