.gitignore000066400000000000000000000003261516132223000130420ustar00rootroot00000000000000/node_modules /build /dist .idea/workspace.xml .idea/tasks.xml .idea/profiles_settings.xml .idea/inspectionProfiles/Project_Default.xml .idea/inspectionProfiles/profiles_settings.xml node_modules/.yarn-integrity .idea/000077500000000000000000000000001516132223000120315ustar00rootroot00000000000000.idea/angular-compile.iml000066400000000000000000000005201516132223000156100ustar00rootroot00000000000000 .idea/codeStyleSettings.xml000066400000000000000000000004251516132223000162300ustar00rootroot00000000000000 .idea/inspectionProfiles/000077500000000000000000000000001516132223000157105ustar00rootroot00000000000000.idea/inspectionProfiles/profiles_settings.xml000066400000000000000000000002341516132223000221740ustar00rootroot00000000000000 .idea/misc.xml000066400000000000000000000002561516132223000135110ustar00rootroot00000000000000 .idea/modules.xml000066400000000000000000000004321516132223000142220ustar00rootroot00000000000000 .idea/vcs.xml000066400000000000000000000002471516132223000133510ustar00rootroot00000000000000 .npmignore000066400000000000000000000003751516132223000130550ustar00rootroot00000000000000/.idea /artifacts /build /test /node_modules /*.iml /*.ipr /*.iws /.travis.yml /.scrutinizer.yml /Gruntfile.js /*.lock *.log /corifeus-boot.json # Corifeus / P3X /tsconfig* /dist/node_modules /dist/test # need to allow ts for awesome=typscript-loader .scrutinizer.yml000066400000000000000000000011151516132223000142310ustar00rootroot00000000000000checks: javascript: true filter: excluded_paths: - node_modules/* build: cache: disabled: true environment: google_chrome: use_latest: true dependencies: before: #- export LATEST=$(nvm ls-remote | tail -1) #- nvm install $LATEST # - nvm use $LATEST - npm install -g grunt-cli npm - npm install - node_modules/protractor/bin/webdriver-manager update --gecko=false tests: override: - command: 'grunt coverage' coverage: file: 'build/coverage/clover.xml' format: 'clover' .travis.yml000066400000000000000000000020401516132223000131560ustar00rootroot00000000000000sudo: required dist: trusty addons: apt: sources: - google-chrome packages: - google-chrome-stable language: node_js node_js: - node before_script: - export DISPLAY=:99.0 - sh -e /etc/init.d/xvfb start - sleep 3 - npm install -g grunt-cli npm - npm install - node_modules/protractor/bin/webdriver-manager update --gecko=false env: global: secure: AZTMyxQS7zCMYjkMCBFD17qmUfnpVdg78/LksBGTV52hVnId5Yyn7OHUzm70kqTrbzqSnnb9ipUO1NEgFNaoxwldavesU/oM0W/EyZ52VNk0hRbseF3TbI83ewCT5X7yIsVeWaUFSDu44g26He2BXfo8wlVP7meG5sfBpV8qNSrOk8MmXEKEheSE9ghv7sUQQpQI2V2/EsWm/CqAh7++70oq1Bdp0U6xzQUw6GRL7xEHYgaXbYYRaHixvzHamjO9enBgUXoZ/d9h+gQlaTTJ0EdgltAkzfewYubb9FAsf7Z0OVFz1bBx2UXOOiW1V00Q76bbOBK7nUt4M05CWhPq1u31JleFVpt4MO9s5Og927fH12tZ5A+3Ss0EN7zrSn7GX7P8YdhDyMBlua9YHZG40GJp7Sb4moB66Y6uZdVN0qCD6a4Jxba+a9l3tCIJCIfEMvY+Xl7epr4Z+fVss2eQGrZPgUgpYNYCE14VK28oLYwCA84cgTHj6CrwbqDKUgk73CfP8f7LD7N9a9pl4rcdflTYWa0iIy71zaAuNflSwJdtoTJEwzT8GeIJlNkakOLVUiOa+jIW9Ah1JY3Pdk30BlczvxuNmMjSx52IR+QS7hNO3Z+7BngvYN3tlM8cpwFQzG/Y2dNiivsrkq0dSWmhjajMg8KNzyeWL5wCYKOKrF0= Gruntfile.js000066400000000000000000000023441516132223000133510ustar00rootroot00000000000000module.exports = (grunt) => { grunt.option('cory-loader-off', true); //node node_modules/protractor/bin/webdriver-manager update const builder = require('corifeus-builder-angular'); /* webdriver-manager/selenium/update-config.json node_modules/protractor/bin/webdriver-manager update */ const loader = new builder.loader(grunt); loader.angular({ root: builder.config.folder.test.angularWebpack.root, replacer: { type: 'p3x', npmio: true, }, config: { clean: { 'cory-publish': [ 'dist' ] } } }); grunt.registerTask('run', builder.config.task.run.angular); grunt.registerTask('default', builder.config.task.build.angular); grunt.registerTask('aot', builder.config.task.build.angularAot); grunt.registerTask('aot-jit', builder.config.task.build.angularAotJit); grunt.registerTask('aot-test', ['webpack:cory-build-aot', 'cory-test-connect']); grunt.registerTask('coverage', 'karma:cory-angular'); grunt.registerTask('publish', ['cory-replace', 'cory-npm', 'cory-publish-angular']); //cori-test:angular-protractor // cori-test:angular-karma }LICENSE000066400000000000000000000024051516132223000120570ustar00rootroot00000000000000 @license p3x-angular-compile v6.0.41-391 🆖 Angular Dynamic Compile component, that turns a string into a compiled component https://pages.corifeus.com/angular-compile Copyright (c) 2018 Patrik Laszlo / P3X / Corifeus and contributors. MIT License Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. README.md000066400000000000000000000165171516132223000123420ustar00rootroot00000000000000[//]: #@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/) [![Build Status](https://travis-ci.org/patrikx3/angular-compile.svg?branch=master)](https://travis-ci.org/patrikx3/angular-compile) [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/patrikx3/angular-compile/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/patrikx3/angular-compile/?branch=master) [![Code Coverage](https://scrutinizer-ci.com/g/patrikx3/angular-compile/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/patrikx3/angular-compile/?branch=master) # 🆖 Angular Dynamic Compile component, that turns a string into a compiled component v6.0.43-406 This is an open-source project. Star this repository if you like it, or even donate! Thank you so much! :) I run my own server with dynamic IP address so it may happen that the server can not be reachable for about max 15 minutes due to the dynamic DNS. The server may also be unreachable when I backup the SSD with Clonzilla (very rarely) or an electrical issue (but this should not happen again). When the server is down, please hang on for 15-30 minutes and the server will be back up. All my domains (patrikx3.com and corifeus.com) could have errors since I am developing in my free time. However, it is usually stable. **Bugs are evident™ - MATRIX️** ### Node Version Requirement ``` >=10.2.1 ``` ### Built on Node ``` v10.6.0 ``` The ```async``` and ```await``` keywords are required. Install NodeJs: https://nodejs.org/en/download/package-manager/ # Built on Angular ```text 6.0.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 & Version It is a ```CommonJS``` bundle by default. But! You can use the native `TypeScript` by `import` from `p3x-angular-compile/src`. The version reflects the Angular version (```AngularMajor.AngularMinor.Build-Commit```). You can find out your proper version with this command: ```bash npm show p3x-angular-compile versions --json ``` ## 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 ### Angular 5.x.x + For now we cannot use AOT + JIT at once. It is too new, we will need more releases and new functions that are removed. #### Info https://github.com/angular/angular/issues/20156 On the bottom, you can see: ```text To reduce the payload we do not ship the compiler in AoT ``` So right now, it is not possible. ### Angular 4.x.x It is not working out of the box (the default is either JIT or AOT, not both), but the apps become 10 folds faster. The ``@ngtools/webpack`` is AOT and the ```awesome-typescript-loader``` is JIT only. The solution can be architect with the ```@angular/compiler``` and the ```awesome-typescript-loader``` together. A miracle! Example here (since I am using Angular 5 not, it is not AOT + JIT anymore, but if you are on Angular 4, you can do it): [More info about AOT + JIT](https://pages.corifeus.com/github/corifeus-builder-angular/artifacts/readme/skeleton.html) ### 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 { }; ``` ```html
``` ```typescript // a page example export class Page { data: string = "
It is working
"; alert() { alert('ok'); } } ``` ### Options [Reference for the Angular module settings.]( https://github.com/angular/angular/blob/master/packages/core/src/metadata/ng_module.ts) ## Dev environment end test ```bash npm install -g yarn git clone https://github.com/patrikx3/angular-compile.git cd angular-compile yarn install grunt run|default ``` [http://localhost:8080](http://localhost:8080) # Errors ## Type x is part of the declarations of 2 modules Basically, you need a shared component. https://stackoverflow.com/questions/42993580/angular-2-type-childcomponent-is-a-part-of-the-declarations-of-2-modules-par [//]: #@corifeus-footer --- [**P3X-ANGULAR-COMPILE**](https://pages.corifeus.com/angular-compile) Build v6.0.43-406 [![Like Corifeus @ Facebook](https://img.shields.io/badge/LIKE-Corifeus-3b5998.svg)](https://www.facebook.com/corifeus.software) [![Donate for Corifeus / P3X](https://img.shields.io/badge/Donate-Corifeus-003087.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=QZVM4V6HVZJW6) [![Contact Corifeus / P3X](https://img.shields.io/badge/Contact-P3X-ff9900.svg)](https://www.patrikx3.com/en/front/contact) ## P3X Sponsors [IntelliJ - The most intelligent Java IDE](https://www.jetbrains.com) [![JetBrains](https://cdn.corifeus.com/assets/svg/jetbrains-logo.svg)](https://www.jetbrains.com/) [![NoSQLBooster](https://cdn.corifeus.com/assets/png/nosqlbooster-70x70.png)](https://www.nosqlbooster.com/) [The Smartest IDE for MongoDB](https://www.nosqlbooster.com) [//]: #@corifeus-footer:endangular-compile.iml000066400000000000000000000006241516132223000146350ustar00rootroot00000000000000 index.ts000066400000000000000000000000271516132223000125270ustar00rootroot00000000000000export * from "./src"; package.json000066400000000000000000000021551516132223000133420ustar00rootroot00000000000000{ "name": "p3x-angular-compile", "version": "6.0.43-406", "corifeus": { "prefix": "p3x-", "publish": true, "type": "p3x", "code": "Logico", "nodejs": "v10.6.0", "opencollective": false, "reponame": "angular-compile", "build": true }, "description": "🆖 Angular Dynamic Compile component, that turns a string into a compiled component", "main": "dist/index.js", "typings": "dist/index", "scripts": { "test": "grunt" }, "repository": { "type": "git", "url": "git+https://github.com/patrikx3/angular-compile.git" }, "keywords": [ "p3x", "angular", "ng", "compile", "html", "angular", "dynamic", "aot" ], "author": "Patrik Laszlo ", "license": "MIT", "bugs": { "url": "https://github.com/patrikx3/angular-compile/issues" }, "homepage": "https://pages.corifeus.com/angular-compile", "devDependencies": { "corifeus-builder-angular": "^6.0.77-447", "corifeus-web": "^6.0.45-433", "corifeus-web-material": "^6.0.35-472" }, "dependencies": {}, "engines": { "node": ">=10.2.1" } }src/000077500000000000000000000000001516132223000116405ustar00rootroot00000000000000src/CompileAttribute.ts000066400000000000000000000076741516132223000155020ustar00rootroot00000000000000import { Component, Input, Injectable, OnInit, OnChanges, SimpleChanges, Type, ModuleWithProviders, NgModule, Compiler, NgModuleFactory, Inject, } from '@angular/core'; import { CommonModule } from '@angular/common'; import { BrowserModule } from '@angular/platform-browser'; let SingletonDefaultModule: NgModule; import { cloneDeep } from 'lodash'; import { CorifeusMaterialModule } from 'corifeus-web-material'; //const cache : any = {}; @Component({ selector: '[p3x-compile]', template: ` ` }) @Injectable() export class CompileAttribute implements OnInit, OnChanges{ @Input('p3x-compile') html: string; @Input('p3x-compile-ctx') context: any; @Input('p3x-compile-error-handler') errorHandler: (ex: any) => void = console.error; dynamicComponent: any; dynamicModule: NgModuleFactory | any; @Input('p3x-compile-module') module: NgModule; @Input('p3x-compile-imports') imports: Array | ModuleWithProviders | any[]>; async update() { if (this.html === undefined || this.html.trim() === '') { // this.container.clear(); this.dynamicComponent = undefined; this.dynamicModule = undefined; return; } /* const cacheKey = this.html; if (Object.keys(cache).indexOf(cacheKey) > -1) { return cache[cacheKey]; } */ try { this.dynamicComponent = this.createNewComponent(this.html, this.context); this.dynamicModule = this.compiler.compileModuleSync(this.createComponentModule(this.dynamicComponent)); // cache[cacheKey] = this.dynamicComponent; } catch (e) { this.errorHandler(e); } /* await this.service.compile({ template: this.html, container: this.container, context: this.context, imports: this.imports, module: this.module }) */ } private createComponentModule (componentType: any) { let module : NgModule = {}; if (this.module !== undefined) { module = cloneDeep(this.module); } else if (SingletonDefaultModule !== undefined && SingletonDefaultModule !== null) { module = cloneDeep(SingletonDefaultModule); } module.imports = module.imports || []; module.imports.push( CommonModule ); if (this.imports !== undefined) { module.imports = module.imports.concat(this.imports) } if (module.declarations === undefined) { module.declarations = [ componentType ]; } else { module.declarations.push(componentType); } module.entryComponents = [ componentType ]; @NgModule(module) class RuntimeComponentModule { } return RuntimeComponentModule; } private createNewComponent (html:string, context: any) { @Component({ selector: 'dynamic-component', template: html }) class DynamicComponent { context: any = context; } return DynamicComponent; } async ngOnInit() { this.update(); } async ngOnChanges(changes: SimpleChanges) { //fixme only update with the required changes this.update(); } constructor( // private container: ViewContainerRef, // private service: CompileService private compiler: Compiler, // @Inject('config') private config:CompileServiceConfig ) { } }src/CompileModule.ts000066400000000000000000000017141516132223000147510ustar00rootroot00000000000000 //import { CompileService, CompileServiceConfig, } from "./CompileService"; import { CompileAttribute} from "./CompileAttribute"; import { NgModule, //ModuleWithProviders, } from '@angular/core'; import { CommonModule } from '@angular/common'; /* import { BrowserModule } from '@angular/platform-browser'; import { Compiler } from '@angular/core'; import {JitCompilerFactory} from '@angular/compiler'; export function createJitCompiler () { return new JitCompilerFactory([{useDebug: false, useJit: true}]).createCompiler(); } */ /* export class CompileServiceConfig { module: NgModule } */ // exports = component @NgModule({ imports: [ CommonModule ], declarations: [ CompileAttribute, ], providers: [ // CompileService, // { provide: Compiler, useFactory: createJitCompiler}, ], exports: [ CompileAttribute, ], entryComponents: [ ] }) export class CompileModule { } src/CompileService.ts000066400000000000000000000067411516132223000151310ustar00rootroot00000000000000/* import { Component, NgModule, Injectable, Compiler, ViewContainerRef, ModuleWithProviders, Type, Optional } from '@angular/core'; import { CommonModule } from '@angular/common'; import { BrowserModule } from '@angular/platform-browser'; import { cloneDeep } from 'lodash'; export interface CompileOptions { template: string; container: ViewContainerRef; imports?: Array | ModuleWithProviders | any[]>; context?: any, onCompiled?: Function, onError?: Function; module?: NgModule; } const cache : any = {}; export class CompileServiceConfig { module: NgModule } let SingletonDefaultModule: NgModule; @Injectable() export class CompileService { constructor( private compiler: Compiler, @Optional() config: CompileServiceConfig, ) { if (config !== undefined && config !== null) { if (config.module !== undefined && config.module !== null) { SingletonDefaultModule = config.module; } } } public async compile(opts: CompileOptions) { try { const factory = await this.createFactory(opts); opts.container.clear(); const cmp : any = opts.container.createComponent(factory); cmp.instance.context = opts.context; } catch (e) { if (opts.onError) { opts.onError(e) } else { console.error(e); } } } private async createFactory(opts: CompileOptions) { const cacheKey = opts.template; if (Object.keys(cache).indexOf(cacheKey) > -1) { return cache[cacheKey]; } cache[cacheKey] = (async() => { try { @Component({ template: opts.template }) class TemplateComponent { context: any } let module : NgModule = {}; if (opts.module !== undefined) { module = cloneDeep(opts.module); } else if (SingletonDefaultModule !== undefined && SingletonDefaultModule !== null) { module = cloneDeep(SingletonDefaultModule); } module.imports = module.imports || []; module.imports.push( CommonModule ); module.imports.push( BrowserModule ); if (opts.imports !== undefined) { module.imports = module.imports.concat(opts.imports) } if (module.declarations === undefined) { module.declarations = [ TemplateComponent ]; } else { module.declarations.push(TemplateComponent); } @NgModule(module) class TemplateModule { } const component = await this.compiler.compileModuleAndAllComponentsAsync(TemplateModule); const factory = component.componentFactories.find((comp) => comp.componentType === TemplateComponent ); cache[cacheKey] = factory; if (opts.onCompiled) { opts.onCompiled(component); } return factory; } catch (e) { delete cache[cacheKey]; throw e; } })(); return cache[cacheKey]; } } */src/index.ts000066400000000000000000000001511516132223000133140ustar00rootroot00000000000000//export * from "./CompileService"; export * from "./CompileAttribute"; export * from "./CompileModule"; test/000077500000000000000000000000001516132223000120305ustar00rootroot00000000000000test/angular-karma/000077500000000000000000000000001516132223000145525ustar00rootroot00000000000000test/angular-karma/CompileModule.ts000066400000000000000000000020261516132223000176600ustar00rootroot00000000000000// you need unlinked npm-s!!! import { TestBed } from '@angular/core/testing'; import { inject } from '@angular/core/testing'; import { CommonModule } from '@angular/common'; import { BrowserModule } from '@angular/platform-browser'; import {CompileAttribute } from '../../src/CompileAttribute' describe('CompileModule', () => { let attribute: CompileAttribute; beforeEach(() => { TestBed.configureTestingModule({ imports: [ CommonModule, BrowserModule ], declarations: [ CompileAttribute ], providers: [ ], }); }); /* beforeEach(inject([CompileAttribute], (_attribute: CompileAttribute) => { attribute = _attribute; })); */ it ('CompileAttribute', (/*done*/) => { // expect(service instanceof CompileService).toBeTruthy(); /* setTimeout(()=> { console.log('done later'); done(); }, 1000); */ }); });test/angular-protractor-disabled/000077500000000000000000000000001516132223000174235ustar00rootroot00000000000000test/angular-protractor-disabled/test.js000066400000000000000000000012301516132223000207340ustar00rootroot00000000000000//browser.ignoreSynchronization = true; describe('CompileHtml', () => { browser.get(`index.html`); const clicker = (button, counter) => { const total = 5; for(let i =0; i < total - 1; i++) { button.click(); browser.waitForAngular(); } const count = counter.getText(); expect(count).toEqual(total.toString()); } it('Attribute', (done) => { setTimeout(() => { const button = element(by.id('button-attribute')) const counter = element(by.id('counter-attribute')); clicker(button, counter); done(); }, 5000) }); });test/angular-webpack/000077500000000000000000000000001516132223000150735ustar00rootroot00000000000000test/angular-webpack/angular/000077500000000000000000000000001516132223000165245ustar00rootroot00000000000000test/angular-webpack/angular/bundle.aot.ts000066400000000000000000000005061516132223000211300ustar00rootroot00000000000000import 'corifeus-web-material/src/bundle' import { enableProdMode } from '@angular/core'; enableProdMode(); //import 'corifeus-web/src/bundle'; import { platformBrowser } from '@angular/platform-browser'; import {ModuleNgFactory} from './module.ngfactory'; platformBrowser().bootstrapModuleFactory(ModuleNgFactory); test/angular-webpack/angular/bundle.ts000066400000000000000000000005001516132223000203400ustar00rootroot00000000000000import { enableProdMode } from '@angular/core'; if (process.env.ENV === 'production') { enableProdMode(); } import 'corifeus-web-material/src/bundle' import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; import {Module} from './module'; platformBrowserDynamic().bootstrapModule(Module); test/angular-webpack/angular/module.ts000066400000000000000000000012311516132223000203560ustar00rootroot00000000000000import { NgModule, } from '@angular/core'; import { RouterModule, Routes } from '@angular/router'; import { CorifeusMaterialModule } from 'corifeus-web-material' import {Page } from './page'; import { CompileModule, } from '../../../src'; export const routes: Routes = [ { path: '', component: Page, }, ]; @NgModule({ imports: [ // BrowserModule, /// CompileModule, CorifeusMaterialModule, // CorifeusModule, RouterModule.forRoot(routes), CompileModule ], declarations: [ Page, ], providers: [ ], bootstrap: [ Page ] }) export class Module { }; test/angular-webpack/angular/page.ts000066400000000000000000000154271516132223000200210ustar00rootroot00000000000000import { Component, Injectable, ViewChild, ViewContainerRef, OnInit, NgModule, CUSTOM_ELEMENTS_SCHEMA, OnDestroy } from '@angular/core'; /* import { MatAutocompleteModule, MatButtonModule, MatButtonToggleModule, MatCardModule, MatCheckboxModule, MatChipsModule, MatCommonModule, MatDatepickerModule, MatDialogModule, MatExpansionModule, MatGridListModule, MatIconModule, MatInputModule, MatLineModule, MatListModule, MatMenuModule, MatNativeDateModule, MatOptionModule, MatPaginatorModule, MatProgressBarModule, MatProgressSpinnerModule, MatRadioModule, MatRippleModule, MatSelectModule, MatSidenavModule, MatSliderModule, MatSlideToggleModule, MatSnackBarModule, MatSortModule, MatTableModule, MatTabsModule, MatToolbarModule, MatTooltipModule, // OverlayContainer, // MatSelectionList, } from '@angular/material'; */ import { MatButtonModule, } from '@angular/material'; @Component({ selector: 'p3x-compile-test', template: `

Some helper URL links

pages.corifeus.com
How it works from the code in GitHub
How the actual Angular Compile looks like

Data1


Data2


Data3


Hidden is working? If show, below should say "Click me via a service!"

If there was no "Click me via a service!" above, it works.

Data2 - This always visible


Pure Router Link with JIT Angular



Router Link with p3x-angular-compile

` }) @Injectable() export class Page implements OnInit, OnDestroy { data1: string; data2: string = 'init'; data3: string = 'Just simple string red'; counter1: number = 0; counter2: number = 0; interval: any; dataRouterLink: string = '' compileForm: string = `` dataMaterialDefault: string = ` ` dataMaterial: string = ` ` dataMaterialModule : any = { // schemas: [CUSTOM_ELEMENTS_SCHEMA], // declarations: [], imports: [ MatButtonModule ], exports: [ ] } constructor( // private compileHtmlService: CompileService ) { } private update1() { this.counter1++; this.data1 = `
P3X Angular Compile
Click me via a angular compile!
{{ context.counter1}}
`; } public formClick() { alert('form click'); } private update2() { this.counter2++; this.data2 = `
Attribute
Click me via an other attribute!
{{ context.counter2}}
`; } chars: string = 'abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ' getRandomChar() { return this.chars[Math.floor(Math.random() * (62 - 0)) + 0] } randomRouterLink() { let counter = 0; let randomString = ''; let randomString2 = ''; while (counter < 10) { counter++; randomString += this.getRandomChar(); randomString2 += this.getRandomChar(); } this.dataRouterLink = `${randomString}` this.dataMaterial = ` ${randomString2}
${this.dataMaterialDefault} ` } ngOnInit() { this.update1(); this.update2(); this.randomRouterLink() /* let is = false; let newData = '123'; let defaultData = ''; let count = 0; this.interval = setInterval(() => { is = !is; if (is) { count++; defaultData = defaultData + newData; this.data3 = defaultData + defaultData; if (count > 10) { count = 0; defaultData = newData; } } else { this.data3 = '
321
' } }, 1000) */ } ngOnDestroy() { clearInterval(this.interval); } }test/angular-webpack/angular/polyfills.ts000066400000000000000000000004641516132223000211150ustar00rootroot00000000000000//import 'corifeus-web/src/polyfills'; import 'core-js/es6'; import 'core-js/es7/reflect.js'; import 'zone.js/dist/zone.js'; if (process.env.ENV === 'production') { // Production } else { // Development Error['stackTraceLimit'] = Infinity; require('zone.js/dist/long-stack-trace-zone'); } test/angular-webpack/assets/000077500000000000000000000000001516132223000163755ustar00rootroot00000000000000test/angular-webpack/assets/style.scss000066400000000000000000000000551516132223000204320ustar00rootroot00000000000000@import 'corifeus-web-material/src/scss/all';test/angular-webpack/index.html000066400000000000000000000003631516132223000170720ustar00rootroot00000000000000 angular-compile-html tsconfig.aot.json000066400000000000000000000014501516132223000143420ustar00rootroot00000000000000{ "compilerOptions": { "skipLibCheck": true, "outDir": "build/aot", "target": "es5", "module": "commonjs", "moduleResolution": "node", "sourceMap": true, "emitDecoratorMetadata": true, "experimentalDecorators": true, "noImplicitAny": true, "suppressImplicitAnyIndexErrors": true, "lib": [ "es5", "es6", "dom", "es2015.collection", "es2015.promise", "es2015.core", "es2016", "es2017" ] }, "include": [ "src/angular/**/*", "test/angular-webpack/**/*" ], "exclude": [ "src/angular/bundle.ts", "test/angular-webpack/angular/bundle.ts", "test/angular-karma", "build/browser" ], "angularCompilerOptions": { "annotationsAs": "decorators", "preserveWhitespaces": false } }tsconfig.build.json000066400000000000000000000011621516132223000146560ustar00rootroot00000000000000{ "compilerOptions": { "skipLibCheck": true, "baseUrl": "./", "target": "es5", "module": "commonjs", "moduleResolution": "node", "sourceMap": true, "emitDecoratorMetadata": true, "experimentalDecorators": true, "noImplicitAny": true, "outDir": "./dist", "suppressImplicitAnyIndexErrors": true, "lib": [ "es5", "es6", "dom", "es2015.collection", "es2015.promise", "es2015.core" ], "paths": { "*": [ "node_modules/@types/*", "*"] } }, "includes": [ "src/**/*" ], "exclude": [ "node_modules", "test" ] }tsconfig.json000066400000000000000000000013711516132223000135620ustar00rootroot00000000000000{ "compilerOptions": { "skipLibCheck": true, "baseUrl": "./", "target": "es5", "module": "commonjs", "moduleResolution": "node", "sourceMap": true, "emitDecoratorMetadata": true, "experimentalDecorators": true, "noImplicitAny": true, "suppressImplicitAnyIndexErrors": true, "lib": [ "es5", "es6", "dom", "es2015.collection", "es2015.promise", "es2015.core" ], "paths": { "*": [ "node_modules/@types/*", "*"] } }, "includes": [ "src/angular/**/*", "test/angular-webpack/**/*" ], "exclude": [ "node_modules", "src/angular/bundle.aot.ts", "test/angular-karma", "test/angular-webpack/angular/bundle.aot.ts", "build/browser" ] }