AngularLibraryToWebComponentsDemo
June 17, 2019 · View on GitHub
This is an Angular workspace that contains:
- Two sample libraries with three Angular components
- Angular demo application with one component showing the three Angular components exchanging data
- The same native page with Web Components compiled from Angular components
- Project "elements" with compilation from Angular to Web components
Commands
ng serve— start an Angular demo app with Angular componentsnpm run build:elements— build single JS file Web Components from Angular components
Key points
-
angular.json contains configuration of application for Angular Elements compilation
-
package.json contains:
document-register-element@v1.8.1@angular/elementsadded usingng add @angular/elements --project=elementscommand@angular-builders/custom-webpackadded usingng add @angular-builders/custom-webpack --project=elementscommandbuild:elementsscript
-
'elements' project contains several scripts for easy building proccess
-
ElementModule — abstract class implementing the whole Angular Element adding process
-
native-demo page — an example with three bundled Web Components exchanging data