You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on May 10, 2021. It is now read-only.
**All required dependencies will be automatically installed** : `@angular/animations`, `@angular/common`, `@angular/core`, `@angular/compiler`, `@angular/elements`, `@angular/platform-browser`, `@angular/platform-browser-dynamic`, `@hapiness/ng-elements-loader`, `core-js`, `document-register-element`, `rxjs` and `zone.js`.
47
+
**All required dependencies will be automatically installed** : `@angular/animations`, `@angular/common`, `@angular/core`, `@angular/compiler`, `@angular/elements`, `@angular/platform-browser`, `@angular/platform-browser-dynamic`, `@hapiness/ng-elements-loader`, `@webcomponents/webcomponentsjs`, `core-js`, `document-register-element`, `rxjs` and `zone.js`.
48
48
49
49
**If your custom element module must have more dependencies, you must install them by yourself**
50
50
@@ -183,7 +183,7 @@ The minimum `package.json` file for your module is described below:
183
183
"name": "made-with-love",
184
184
"version": "1.0.0",
185
185
"peerDependencies": {
186
-
"@hapiness/custom-elements-loader": "^7.0.0"
186
+
"@hapiness/custom-elements-loader": "^7.1.0"
187
187
}
188
188
}
189
189
```
@@ -234,9 +234,14 @@ We create a `HTML`file with our `custom element` inside.
234
234
```typescript
235
235
// POLYFILLS
236
236
import'zone.js/dist/zone';
237
-
import'document-register-element';
238
237
import'core-js/es7/reflect';
239
238
239
+
/** In browsers that don't support Custom Elements natively **/
240
+
// import 'document-register-element';
241
+
242
+
/** You must add this if your application will be compiled in es5 because the specification requires developers use ES2015 classes to define Custom Elements **/
@@ -262,13 +267,18 @@ Loading of the component happens inside `main.ts` file.
262
267
263
268
```typescript
264
269
import'zone.js/dist/zone';
265
-
import'document-register-element';
266
270
import'core-js/es7/reflect';
267
271
```
268
272
269
273
- Additional **polyfills** can be added if needed:
270
274
271
275
```typescript
276
+
/** In browsers that don't support Custom Elements natively **/
277
+
// import 'document-register-element';
278
+
279
+
/** You must add this if your application will be compiled in es5 because the specification requires developers use ES2015 classes to define Custom Elements **/
/** IE9, IE10 and IE11 requires all of the following polyfills. **/
273
283
// import 'core-js/es6/symbol';
274
284
// import 'core-js/es6/object';
@@ -399,10 +409,14 @@ We set a **listener** to catch `sayHello` event and do what we want:
399
409
```typescript
400
410
// POLYFILLS
401
411
import'zone.js/dist/zone';
402
-
import'document-register-element';
403
-
import'core-js/es6/reflect';
404
412
import'core-js/es7/reflect';
405
413
414
+
/** In browsers that don't support Custom Elements natively **/
415
+
// import 'document-register-element';
416
+
417
+
/** You must add this if your application will be compiled in es5 because the specification requires developers use ES2015 classes to define Custom Elements **/
*`document-register-elements v1.13.1` latest version of the `polyfill` only require if your browser doesn't support `customElement`
439
+
*`@webcomponents/webcomponentsjs v2.1.3` to fix issue with `es5` compilation outside `Angular` application like explain [here](https://github.com/angular/angular/issues/24390#issuecomment-437361929)
440
+
* Allow **custom elements registration** in browser even if tag isn't yet present in the `DOM` like this, it can be created or loaded asynchronously after registration
schemas: [ CUSTOM_ELEMENTS_SCHEMA ] // this line must be added
432
+
})
433
+
exportclassAppModule {
434
+
}
435
+
```
436
+
437
+
**tsconfig.json**
438
+
439
+
````json
440
+
{
441
+
"compileOnSave": false,
442
+
"compilerOptions": {
443
+
"baseUrl": "./",
444
+
"outDir": "./dist/out-tsc",
445
+
"sourceMap": true,
446
+
"declaration": false,
447
+
"module": "es2015",
448
+
"moduleResolution": "node",
449
+
"emitDecoratorMetadata": true,
450
+
"experimentalDecorators": true,
451
+
"target": "es2015", // this line must switch target from es5 to es2015
452
+
"typeRoots": [
453
+
"node_modules/@types"
454
+
],
455
+
"lib": [
456
+
"es2018",
457
+
"dom"
458
+
]
459
+
}
460
+
}
461
+
````
462
+
463
+
**If your browser doesn't support natively `customElement` like explain [here](https://angular.io/guide/elements#browser-support-for-custom-elements), you must add `document-register-element` inside `src/polyfills.ts` file**
464
+
408
465
## Change History
466
+
* v7.1.0 (2018-11-09)
467
+
*`Angular v7.0.3+`
468
+
*`document-register-elements v1.13.1` latest version of the `polyfill` only require if your browser doesn't support `customElement`
469
+
*`@webcomponents/webcomponentsjs v2.1.3` to fix issue with `es5` compilation outside `Angular` application like explain [here](https://github.com/angular/angular/issues/24390#issuecomment-437361929)
470
+
* Allow **custom elements registration** in browser even if tag isn't yet present in the `DOM` like this, it can be created or loaded asynchronously after registration
0 commit comments