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

Make component methods protected to support Component inheritance #1505

Closed
JonnyHeavey opened this issue Jan 20, 2017 · 8 comments
Closed

Make component methods protected to support Component inheritance #1505

JonnyHeavey opened this issue Jan 20, 2017 · 8 comments

Comments

@JonnyHeavey
Copy link

Type of issue: (check with "[x]")

- [X] New feature request
- [ ] Bug  
- [ ] Support request

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 the UploadService from scratch, and repeat much of the code already found within UploadButtonComponent. If functions such as uploadFiles were protected instead of private, I wouldn't need to do this.

@eromano
Copy link
Contributor

eromano commented Jan 20, 2017

@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.

@davidcognite
Copy link

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.

@JonnyHeavey
Copy link
Author

@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.

@DenysVuika
Copy link
Contributor

DenysVuika commented Jan 20, 2017

@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.

@DenysVuika
Copy link
Contributor

Additional information on inheritance in 2.3: Component Inheritance in Angular 2

@eromano
Copy link
Contributor

eromano commented Jan 22, 2017

@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.

@JonnyHeavey
Copy link
Author

@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.

@magemello magemello added this to the 1.1.1 milestone Jan 23, 2017
@DenysVuika
Copy link
Contributor

Depends on #1522

@magemello magemello modified the milestones: 1.1.3, 1.1.2 Feb 24, 2017
@eromano eromano modified the milestones: 1.3.0, 1.4.0 Mar 30, 2017
@eromano eromano modified the milestones: 1.5.0, 1.4.0 Apr 24, 2017
This was referenced Apr 24, 2017
@eromano eromano closed this as completed May 25, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants