Extended custom elements not working in Angular 2+ The Next CEO of Stack OverflowExtending native HTML element in Angular 6How do JavaScript closures work?How do I detect a click outside an element?How do I check if an element is hidden in jQuery?Event binding on dynamically created elements?How does JavaScript .prototype work?How can I select an element with multiple classes in jQuery?How to move an element into another element?How do I remove a particular element from an array in JavaScript?jQuery scroll to elementHow does data binding work in AngularJS?

Which one is the true statement?

What would be the main consequences for a country leaving the WTO?

Is there such a thing as a proper verb, like a proper noun?

Physiological effects of huge anime eyes

Is it convenient to ask the journal's editor for two additional days to complete a review?

Getting Stale Gas Out of a Gas Tank w/out Dropping the Tank

Computationally populating tables with probability data

Is there a way to save my career from absolute disaster?

How to avoid supervisors with prejudiced views?

Do scriptures give a method to recognize a truly self-realized person/jivanmukta?

Won the lottery - how do I keep the money?

Why did early computer designers eschew integers?

What CSS properties can the br tag have?

"Eavesdropping" vs "Listen in on"

Why don't programming languages automatically manage the synchronous/asynchronous problem?

How did Beeri the Hittite come up with naming his daughter Yehudit?

From jafe to El-Guest

How do I fit a non linear curve?

What are the unusually-enlarged wing sections on this P-38 Lightning?

What does "shotgun unity" refer to here in this sentence?

Are the names of these months realistic?

Is dried pee considered dirt?

Would a grinding machine be a simple and workable propulsion system for an interplanetary spacecraft?

Why do we say 'Un seul M' and not 'Une seule M' even though M is a "consonne"



Extended custom elements not working in Angular 2+



The Next CEO of Stack OverflowExtending native HTML element in Angular 6How do JavaScript closures work?How do I detect a click outside an element?How do I check if an element is hidden in jQuery?Event binding on dynamically created elements?How does JavaScript .prototype work?How can I select an element with multiple classes in jQuery?How to move an element into another element?How do I remove a particular element from an array in JavaScript?jQuery scroll to elementHow does data binding work in AngularJS?










0















I can't get Angular (2+, not AngularJS) to play nice with my extended custom element, which is defined like so:



 class FancyButton extends HTMLButtonElement 
connectedCallback()
this.innerText = `I'm a fancy-button!`;
this.style.backgroundColor = 'tomato';



customElements.define("fancy-button", FancyButton,
extends: "button"
);


And used like so:



<button is="fancy-button">Fancy button here</button>


The definition is fully compliant to web standards according to this Google Developer resource:
https://developers.google.com/web/fundamentals/web-components/customelements#extend



It's working fine in a vanilla web setup and in React, but Angular ignores it and shows a standard button, apparently ignoring the is="fancy-button" attribute.



Here is a stackblitz showing this in action.
One fancy-button is outside the Angular scope (index.html) and is working fine.
The other button is inside the Angular scope (app.component.html) and is NOT working.



Why oh why?










share|improve this question






















  • I wouldn't even go that way... we have directives to use just for cases like this :) stackblitz.com/edit/angular-lqz3xt?file=src/app/…

    – AJT_82
    Mar 21 at 19:29











  • I see. I'm doing this to be framework agnostic and I think the "is="fancy-button" approach is very nice for that. Works perfectly in React without any React-specific code.

    – Kim Andersen
    Mar 21 at 19:32











  • I'm not using the <script> tag in a template. It's in the index.html file. However, I get your point and thanks for your reply. This question is about the same issue if you're interested: stackoverflow.com/questions/53604958/…

    – Kim Andersen
    Mar 21 at 19:48
















0















I can't get Angular (2+, not AngularJS) to play nice with my extended custom element, which is defined like so:



 class FancyButton extends HTMLButtonElement 
connectedCallback()
this.innerText = `I'm a fancy-button!`;
this.style.backgroundColor = 'tomato';



customElements.define("fancy-button", FancyButton,
extends: "button"
);


And used like so:



<button is="fancy-button">Fancy button here</button>


The definition is fully compliant to web standards according to this Google Developer resource:
https://developers.google.com/web/fundamentals/web-components/customelements#extend



It's working fine in a vanilla web setup and in React, but Angular ignores it and shows a standard button, apparently ignoring the is="fancy-button" attribute.



Here is a stackblitz showing this in action.
One fancy-button is outside the Angular scope (index.html) and is working fine.
The other button is inside the Angular scope (app.component.html) and is NOT working.



Why oh why?










share|improve this question






















  • I wouldn't even go that way... we have directives to use just for cases like this :) stackblitz.com/edit/angular-lqz3xt?file=src/app/…

    – AJT_82
    Mar 21 at 19:29











  • I see. I'm doing this to be framework agnostic and I think the "is="fancy-button" approach is very nice for that. Works perfectly in React without any React-specific code.

    – Kim Andersen
    Mar 21 at 19:32











  • I'm not using the <script> tag in a template. It's in the index.html file. However, I get your point and thanks for your reply. This question is about the same issue if you're interested: stackoverflow.com/questions/53604958/…

    – Kim Andersen
    Mar 21 at 19:48














0












0








0








I can't get Angular (2+, not AngularJS) to play nice with my extended custom element, which is defined like so:



 class FancyButton extends HTMLButtonElement 
connectedCallback()
this.innerText = `I'm a fancy-button!`;
this.style.backgroundColor = 'tomato';



customElements.define("fancy-button", FancyButton,
extends: "button"
);


And used like so:



<button is="fancy-button">Fancy button here</button>


The definition is fully compliant to web standards according to this Google Developer resource:
https://developers.google.com/web/fundamentals/web-components/customelements#extend



It's working fine in a vanilla web setup and in React, but Angular ignores it and shows a standard button, apparently ignoring the is="fancy-button" attribute.



Here is a stackblitz showing this in action.
One fancy-button is outside the Angular scope (index.html) and is working fine.
The other button is inside the Angular scope (app.component.html) and is NOT working.



Why oh why?










share|improve this question














I can't get Angular (2+, not AngularJS) to play nice with my extended custom element, which is defined like so:



 class FancyButton extends HTMLButtonElement 
connectedCallback()
this.innerText = `I'm a fancy-button!`;
this.style.backgroundColor = 'tomato';



customElements.define("fancy-button", FancyButton,
extends: "button"
);


And used like so:



<button is="fancy-button">Fancy button here</button>


The definition is fully compliant to web standards according to this Google Developer resource:
https://developers.google.com/web/fundamentals/web-components/customelements#extend



It's working fine in a vanilla web setup and in React, but Angular ignores it and shows a standard button, apparently ignoring the is="fancy-button" attribute.



Here is a stackblitz showing this in action.
One fancy-button is outside the Angular scope (index.html) and is working fine.
The other button is inside the Angular scope (app.component.html) and is NOT working.



Why oh why?







javascript angular






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 21 at 19:09









Kim AndersenKim Andersen

2215




2215












  • I wouldn't even go that way... we have directives to use just for cases like this :) stackblitz.com/edit/angular-lqz3xt?file=src/app/…

    – AJT_82
    Mar 21 at 19:29











  • I see. I'm doing this to be framework agnostic and I think the "is="fancy-button" approach is very nice for that. Works perfectly in React without any React-specific code.

    – Kim Andersen
    Mar 21 at 19:32











  • I'm not using the <script> tag in a template. It's in the index.html file. However, I get your point and thanks for your reply. This question is about the same issue if you're interested: stackoverflow.com/questions/53604958/…

    – Kim Andersen
    Mar 21 at 19:48


















  • I wouldn't even go that way... we have directives to use just for cases like this :) stackblitz.com/edit/angular-lqz3xt?file=src/app/…

    – AJT_82
    Mar 21 at 19:29











  • I see. I'm doing this to be framework agnostic and I think the "is="fancy-button" approach is very nice for that. Works perfectly in React without any React-specific code.

    – Kim Andersen
    Mar 21 at 19:32











  • I'm not using the <script> tag in a template. It's in the index.html file. However, I get your point and thanks for your reply. This question is about the same issue if you're interested: stackoverflow.com/questions/53604958/…

    – Kim Andersen
    Mar 21 at 19:48

















I wouldn't even go that way... we have directives to use just for cases like this :) stackblitz.com/edit/angular-lqz3xt?file=src/app/…

– AJT_82
Mar 21 at 19:29





I wouldn't even go that way... we have directives to use just for cases like this :) stackblitz.com/edit/angular-lqz3xt?file=src/app/…

– AJT_82
Mar 21 at 19:29













I see. I'm doing this to be framework agnostic and I think the "is="fancy-button" approach is very nice for that. Works perfectly in React without any React-specific code.

– Kim Andersen
Mar 21 at 19:32





I see. I'm doing this to be framework agnostic and I think the "is="fancy-button" approach is very nice for that. Works perfectly in React without any React-specific code.

– Kim Andersen
Mar 21 at 19:32













I'm not using the <script> tag in a template. It's in the index.html file. However, I get your point and thanks for your reply. This question is about the same issue if you're interested: stackoverflow.com/questions/53604958/…

– Kim Andersen
Mar 21 at 19:48






I'm not using the <script> tag in a template. It's in the index.html file. However, I get your point and thanks for your reply. This question is about the same issue if you're interested: stackoverflow.com/questions/53604958/…

– Kim Andersen
Mar 21 at 19:48













0






active

oldest

votes












Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55287677%2fextended-custom-elements-not-working-in-angular-2%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55287677%2fextended-custom-elements-not-working-in-angular-2%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript