[//]: #@corifeus-header [![NPM](https://nodei.co/npm/p3x-angular-compile.png?downloads=true&downloadRank=true&stars=true)](https://www.npmjs.com/package/p3x-angular-compile/) [![Donate for Corifeus / P3X](https://img.shields.io/badge/Donate-Corifeus-003087.svg)](https://paypal.me/patrikx3) [![Contact Corifeus / P3X](https://img.shields.io/badge/Contact-P3X-ff9900.svg)](https://www.patrikx3.com/en/front/contact) [![Corifeus @ Facebook](https://img.shields.io/badge/Facebook-Corifeus-3b5998.svg)](https://www.facebook.com/corifeus.software) [![Build Status](https://api.travis-ci.com/patrikx3/angular-compile.svg?branch=master)](https://travis-ci.com/patrikx3/angular-compile) [![Uptime Robot ratio (30 days)](https://img.shields.io/uptimerobot/ratio/m780749701-41bcade28c1ea8154eda7cca.svg)](https://uptimerobot.patrikx3.com/) # 🆖 Angular Dynamic Compile component, that turns a string into a compiled component v2019.3.7-1 🙏 This is an open-source project. Star this repository, if you like it, or even donate to maintain the servers and the development. Thank you so much! Possible, this mini server, rarely, is down, please hang on for 15-30 minutes and the server will be back up. All my domains ([patrikx3.com](https://patrikx3.com) and [corifeus.com](https://corifeus.com)) could have minor errors, since I am developing in my free time. However, it is usually stable. **Bugs are evident™ - MATRIX️** ### Node Version Requirement ``` >=10.13.0 ``` ### Built on Node ``` v11.10.1 ``` The ```async``` and ```await``` keywords are required. Install NodeJs: https://nodejs.org/en/download/package-manager/ # Built on Angular ```text 7.2.7 ``` # Description [//]: #@corifeus-header:end # Use case Dynamic compile components by a string template for Angular. You can provide a context, that you can use with anything (for clicking for free etc..) ## NPM It is a ```CommonJS``` bundle by default. But! You can use the native `TypeScript` by `import` from `p3x-angular-compile/src`. ## Install ```bash npm install --save p3x-angular-compile # or yarn add p3x-angular-compile ``` ## Check out how it works and code https://angular-compile.corifeus.com https://github.com/patrikx3/angular-compile/blob/master/test/angular-webpack/angular/page.ts#L115 ## AOT + JIT ### Since Angular 5.x.x + We cannot use AOT + JIT at once. #### Info https://github.com/angular/angular/issues/20156#issuecomment-341767899 On the issue, you can see: ```text To reduce the payload, we do not ship the compiler in AOT. ``` So right now, it is not possible. ### Size If you want very small bundle, use ```gzip```. ## Usage ```typescript import { CompileModule} from "p3x-angular-compile" // the module settings @NgModule({ imports: [ // multiple directives in a shared module like this CorifeusWebMaterialModule, // usually it is enough CompileModule, ], declarations: [ Page, ], providers: [ ], bootstrap: [ Page ] }) export class Module { }; ``` #### The template ```html