diff --git a/packages/change-detection/packages/demo/src/app/class/class.component.spec.ts b/packages/core/demo/src/app/bind-property/bind-property.component.spec.ts
similarity index 53%
rename from packages/change-detection/packages/demo/src/app/class/class.component.spec.ts
rename to packages/core/demo/src/app/bind-property/bind-property.component.spec.ts
index e4c803eb..c52dfcc5 100644
--- a/packages/change-detection/packages/demo/src/app/class/class.component.spec.ts
+++ b/packages/core/demo/src/app/bind-property/bind-property.component.spec.ts
@@ -1,20 +1,20 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
-import { ClassComponent } from './class-component.component';
+import { BindPropertyComponent } from './bind-property.component';
-describe('ClassComponentComponent', () => {
- let component: ClassComponent;
- let fixture: ComponentFixture;
+describe('BindPropertyComponent', () => {
+ let component: BindPropertyComponent;
+ let fixture: ComponentFixture;
beforeEach(async(() => {
TestBed.configureTestingModule({
- declarations: [ ClassComponent ]
+ declarations: [ BindPropertyComponent ]
})
.compileComponents();
}));
beforeEach(() => {
- fixture = TestBed.createComponent(ClassComponent);
+ fixture = TestBed.createComponent(BindPropertyComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
diff --git a/packages/core/demo/src/app/bind-property/bind-property.component.ts b/packages/core/demo/src/app/bind-property/bind-property.component.ts
new file mode 100644
index 00000000..ce83b6a2
--- /dev/null
+++ b/packages/core/demo/src/app/bind-property/bind-property.component.ts
@@ -0,0 +1,26 @@
+import { Component, OnInit } from '@angular/core';
+
+import { BindProperty } from '../core/property';
+
+@Component({
+ selector: 'app-bind-property',
+ templateUrl: './bind-property.component.html',
+ styleUrls: ['./bind-property.component.css']
+})
+@BindProperty(['firstname'], 'target')
+export class BindPropertyComponent implements OnInit {
+
+ firstname = '';
+
+ target = {
+ firstname: ''
+ };
+
+ constructor() { }
+
+ ngOnInit() {
+ this.firstname = 'bind property works!';
+ console.log(this);
+ }
+
+}
diff --git a/packages/core/demo/src/app/core/component-loader/CHANGELOG.md b/packages/core/demo/src/app/core/component-loader/CHANGELOG.md
new file mode 100644
index 00000000..7e666b5e
--- /dev/null
+++ b/packages/core/demo/src/app/core/component-loader/CHANGELOG.md
@@ -0,0 +1,17 @@
+# Changelog 'component-loader' package
+
+All notable changes to this project will be documented in this file.
+
+The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
+and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
+
+## [Unreleased]
+
+### Changed
+
+
+
+
+[Unreleased]: https://github.com/angular-package/angular-package/compare/core
+
+
diff --git a/packages/core/demo/src/app/core/component-loader/ComponentLoader.md b/packages/core/demo/src/app/core/component-loader/ComponentLoader.md
new file mode 100644
index 00000000..d8376bc3
--- /dev/null
+++ b/packages/core/demo/src/app/core/component-loader/ComponentLoader.md
@@ -0,0 +1,453 @@
+# ComponentLoader
+
+Decorator to help handle `ComponentLoaderService` easier.
+
+```typescript
+import { ComponentLoader } from '@angular-package/core/component-loader';
+```
+
+```typescript
+@ComponentLoader(config: ComponentLoaderConfigInterface)
+```
+
+
+**Pros(+):**
+* Treeshake bundle with **[Rollup](https://rollupjs.org/#introduction)** - module bundler for JavaScript.
+* **AOT** (Ahead Of Time Compilation) package: *faster rendering*, *fewer asynchronous requests*, *smaller Angular framework download size*, *detect template errors earlier*, *better security*.
+* **MIT** License: it can be used commercially.
+* Handle `ComponentLoaderService` by creating component internal methods and properties linked to service.
+* Automatically link indicated properties.
+* Define container by querySelector.
+* Change component property name.
+* Tested with jasmine.
+
+**Cons(-):**
+* Need to inject `ComponentLoaderService` in constructor to use decorator with specific name `componentLoaderService`.
+* There is no interface implementation for added method and properties in component.
+
+**Important!**
+* Add `ComponentLoaderService` to component `providers`.
+
+----
+
+* [Demonstration](#demonstration)
+* [Installation](#installation)
+* [Config](#config)
+* [Properties](#properties)
+* [Methods](#methods)
+* [Usage](#usage)
+* [Scripts](#scripts)
+* [Git](#git)
+ * [Commit](#commit)
+ * [Versioning](#versioning)
+* [License](#license)
+
+----
+
+## Demonstration
+
+
+
+Demo available inside repository.
+
+Clone repository:
+
+```bash
+git clone https://github.com/angular-package/angular-package.git
+```
+
+Go to core package with example demo:
+```bash
+cd angular-package/packages/core/packages/component-loader/demo
+```
+
+Install dependencies and start:
+```bash
+npm i && npm start
+```
+
+## Installation
+
+```bash
+npm i @angular-package/core@latest --save
+```
+
+Install peer dependencies:
+
+```bash
+npm i lodash-es@4.17.7 --save
+```
+
+## Config
+
+```typescript
+interface ComponentLoaderConfigInterface {
+ component: Type;
+ componentPropertyName?: string;
+ container: string;
+ properties?: string[];
+ prefix?: string;
+ suffix?: string;
+}
+```
+
+Properties | Type | Default value | Description |
+----------------------|----------|---------|------------------------------------------------|
+component? | Type | | Place where dynamic component will be created. |
+componentPropertyName | string | '__componentRef' | Name of the place where dynamic component will be created. |
+prefix? | string | '_' | Prefix to create property that will be wrapped. It is used only in `__link` method. |
+properties? | string[] | [] | Name of properties from source component that will be connected with dynamic component. |
+suffix? | string | '' | Suffix to create property that will be wrapped. It is used only in `__link` method. |
+
+
+## Properties
+
+ Properties | Wrapping | Default value | Description |
+------------------------|----------|----------------------------------------|------------------------------------------------|
+__component | componentLoaderService. __component | | Place where dynamic component will be created. |
+__componentPropertyName | componentLoaderService. componentPropertyName | '__componentRef' | Name of the place where dynamic component will be created. |
+__prefix | componentLoaderService. prefix | '_' | Prefix to create property that will be wrapped. It is used only in `__link` method. |
+__properties | componentLoaderService. properties | [] | Name of properties from source component that will be connected with dynamic component. |
+__suffix | componentLoaderService. suffix | '' | Suffix to create property that will be wrapped. It is used only in `__link` method. |
+
+## Methods
+
+Assign values of property or list of properties from source component to dynamic component instance.
+
+Property | Type | Default value | Description |
+---------|------------------|-------------------|---------------------------|
+p | string\|string[] | this.__properties | Properties that values will be set from source component to dynamic component. |
+source | S | | Source component means component which properties values will be assigned to dynamic component. |
+
+```typescript
+/**
+ * Assign values of property or list of properties from source component to dynamic component instance.
+ * @param {(string | string[])} p Property that values will be set from source component to dynamic component.
+ * @memberof ComponentLoaderCommonAClass
+ */
+__assign(p: string | string[]): void;
+```
+
+Create resolved component.
+
+Property | Type | Description |
+----------|------------------|-------------|
+component | ComponentType\ | Component that will be created. |
+
+```typescript
+/**
+ * Create resolved component.
+ * @returns {*}
+ * @memberof ComponentLoaderClass
+ */
+__create(): any
+```
+
+Destroy component.
+
+```typescript
+/**
+ * Destroy component.
+ * @returns {void}
+ * @memberof ComponentLoaderClass
+ */
+__destroy(): void
+```
+
+Get specified property value from dynamic component instance.
+
+Property | Type | Description |
+----------|--------|-------------|
+property | string | Name of property that will be get from dynamic component instance. |
+
+
+```typescript
+/**
+ * Get specified property value from dynamic component instance.
+ * @param {string} property Name of property that will be get from instance.
+ * @returns {*} Return value.
+ * @memberof ComponentLoaderCommonAClass
+ */
+__get(property: string): any
+```
+
+Set specified property value to dynamic component instance.
+
+Property | Type | Description |
+----------|--------|-------------|
+property | string | Name of property that will be set to dynamic component instance. |
+value | V | Value of property that will be set to dynamic component instance. |
+
+
+```typescript
+/**
+ * Set specified property value to dynamic component instance.
+ * @param {string} property Name of property that will be set to dynamic component instance.
+ * @param {*} value Value of property that will be set to dynamic component instance.
+ * @memberof ComponentLoaderCommonAClass
+ */
+public __set(property: string, value: any): void
+```
+
+
+Subscribe to specified property of dynamic component instance.
+
+Property | Type | Description |
+---------|--------|-------------|
+property | string | Property name of dynamic component instance we want to subscribe to. |
+...args | any[] | Arguments with function with features in order `success`, `error`, `complete` |
+
+```typescript
+/**
+ * Subscribe to specified property of dynamic component instance.
+ * @param {string} property Property name of dynamic component instance.
+ * @param {...any[]} args Functions in order success, error, complete.
+ * @memberof ComponentLoaderCommonAClass
+ */
+public __subscribe(property: string, ...args: any[]): void
+```
+
+## Usage
+
+Usage example below based on angular-cli **1.6.8** starts from scratch.
+
+
+**Step 1.** Generate new example project
+
+```bash
+ng new demo
+```
+
+**Step 2.** Change `tsconfig.json` target from `es5` to `es6`.
+
+```json
+{
+ "compilerOptions": {
+ ...
+ "target": "es6",
+ ...
+ }
+}
+
+```
+
+**Step 3.** Add `--aot` to `ng-serve` in `package.json`.
+```json
+ "scripts": {
+ "ng": "ng",
+ "start": "ng serve --aot", // <------------ Here.
+ "build": "ng build --prod",
+ "test": "ng test",
+ "lint": "ng lint",
+ "e2e": "ng e2e"
+ },
+```
+
+**Step 4.** Add component that will be dynamically handled.
+
+```typescript
+// dynamic.component.ts
+import { Component, EventEmitter, Output, Input } from '@angular/core';
+
+@Component({
+ selector: 'app-dynamic-component',
+ template: `
+