-
Notifications
You must be signed in to change notification settings - Fork 0
/
route.component.ts
28 lines (21 loc) · 944 Bytes
/
route.component.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { ComponentInjectorComponent } from 'src/app/component-injector/component-injector.component';
@Component({
selector: 'route',
templateUrl: './route.component.html',
styleUrls: ['./route.component.css']
})
export class RouteComponent implements OnInit {
component: ComponentInjectorComponent;
constructor(private route: ActivatedRoute) { }
ngOnInit(): void {
for (let output in this.route.snapshot.data.component.outputs) {
this.route.snapshot.data.component.outputs[output] = this.route.snapshot.data.component.outputs[output].bind(this)
}
for (let routeDataInput in this.route.snapshot.data.component.routeDataInputs) {
this.route.snapshot.data.component.inputs[routeDataInput] = this.route.snapshot.data[routeDataInput];
}
this.component = this.route.snapshot.data.component;
}
}