-
Notifications
You must be signed in to change notification settings - Fork 24.8k
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 HTML components #19108
Comments
What do you mean exactly by |
Have a look at @angular/material. They do the same thing you are looking for with md-form-field and their other components. |
If I understand this correctly, this is something that should really be considered, as it would simplified the creation of custom elements.
One possibility is to extends HTMLElement, but... https://stackblitz.com/edit/angular-extending-html-elements I think the use case of this can very specific, but still, it would be useful, more now that standard custom elements can be created with Angular. Maybe there are more use cases that can be added. As I understand, this is about reducing the html tree complexity, instead of creating an input in a component, that component is itself an input. |
I think by "extending" HTML elements they meant being able to base Angular component on some existing HTMLElement. For example if you want to expose Angular Component as a WebComponent via customElements.define('my-input', createCustomElement(MyInputComponent), {extends: 'input'}) So that later you may use it like so: <input is="my-input"> But if you will run it like this right now you will get an error: This is due to the fact that browser will check if your component class actually extends The fix here is pretty simple - The example is here: https://stackblitz.com/edit/angular-fmumfu?file=src%2Fapp%2Fapp.module.ts |
Just a heads up that we kicked off a community voting process for your feature request. There are 20 days until the voting process ends. Find more details about Angular's feature request process in our documentation. |
Thank you for submitting your feature request! Looks like during the polling process it didn't collect a sufficient number of votes to move to the next stage. We want to keep Angular rich and ergonomic and at the same time be mindful about its scope and learning journey. If you think your request could live outside Angular's scope, we'd encourage you to collaborate with the community on publishing it as an open source package. You can find more details about the feature request process in our documentation. |
I'm going to close this for a couple reasons:
|
I'm sorry but I think it's pretty clear what this feature request is about:
All we are asking here is to allow to pass a different subclass of I hope that with linked examples it's more clear what we are trying to achieve. |
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. |
I'm submitting a...
Current behavior
To be honest, this isn't much of an issue, but rather a question. Would it be possible to extend HTML components, like
div
,input
,span
and etc.? This would simplify the current requirement to map all the properties (classes, fields, declarations, events) from underlying template of your custom component to its declaration.For example, currently you have to:
In polaris-textfield.component.html
In polaris-textfield.component.ts
And in app.component.html
Expected behavior
Instead, it would be lovely if you could extend something like
Input
and then link this component to underlying template's element that would be represented by this component.What is the motivation / use case for changing the behavior?
It would remove the requirement to map fields to underlying templates.
Environment
The text was updated successfully, but these errors were encountered: