angular-custom-element | Web Components Custom Element enhanced directives | Web Framework library
kandi X-RAY | angular-custom-element Summary
kandi X-RAY | angular-custom-element Summary
Why wait for AngularJS 2.0 to start writing Angular code for the W3C Web Components specifications? With just a tiny, 2kb, Custom Element polyfill plus this provider you can define, export, import, and use Custom Elements within your AngularJS 1.x.x app or component now. Your AngularJS element directives can now be real, bonafide Custom Element directives. The element properties are seemlesly bound to your directive's $scope, so changes from outside Angular will be immediately reflected in your Angular bindings.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of angular-custom-element
angular-custom-element Key Features
angular-custom-element Examples and Code Snippets
Community Discussions
Trending Discussions on angular-custom-element
QUESTION
What does Angular recommend for Polyfilling support for custom elements built with Angular?
This demo works with only this polyfill added to polyfills.ts
:
ANSWER
Answered 2020-Apr-14 at 08:41it all depends on which browsers you want to support and bundle syntax that your application is generating.
@webcomponents/custom-elements/src/native-shim
and @webcomponents/webcomponentsjs/custom-elements-es5-adapter.js
serve the same purpose, these are used if the browser does not support ES2015 modules or because the application is explicitly configured to generate ES5 only bundles.
@webcomponents/custom-elements
and @webcomponents/custom-elements/src/native-shim
also serve the same purpose which is to provide support for custom elements for browsers that do not natively support Custom Elements.
More information about those polyfills and why and when they are needed;
- https://github.com/webcomponents/polyfills/tree/master/packages/custom-elements
- https://github.com/webcomponents/polyfills/tree/master/packages/webcomponentsjs
I wouldn't recommend on using the below pattern.
QUESTION
Trying to turn the HelloComponent
that comes with the Stackblitz Angular default project into a Web Component that runs in the same project.
https://stackblitz.com/edit/angular-custom-elements-hello?file=src%2Fapp%2Fapp.module.ts
Within the AppModule
I've registered it like this:
ANSWER
Answered 2020-Apr-10 at 07:49Well you need a few changed in order to make it work in a Stackblitz environment.
First you need this package :
@webcomponents/webcomponentsjs
Then you need to add it to polyfills.ts
import '@webcomponents/webcomponentsjs/custom-elements-es5-adapter.js'
And also you should remove the
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install angular-custom-element
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page