fix(angular): params are assigned to props

This commit is contained in:
Manu Mtz.-Almeida
2018-05-10 21:28:19 +02:00
parent 95fb594fe2
commit 7fa6e43069

View File

@ -73,14 +73,15 @@ export function attachView(
? location.createComponent(factory, location.length, childInjector) ? location.createComponent(factory, location.length, childInjector)
: factory.create(childInjector); : factory.create(childInjector);
const instance = componentRef.instance;
const hostElement = componentRef.location.nativeElement; const hostElement = componentRef.location.nativeElement;
if (params) { if (params) {
Object.assign(hostElement, params); Object.assign(instance, params);
} }
for (const clazz of cssClasses) { for (const clazz of cssClasses) {
hostElement.classList.add(clazz); hostElement.classList.add(clazz);
} }
bindLifecycleEvents(componentRef.instance, hostElement); bindLifecycleEvents(instance, hostElement);
container.appendChild(hostElement); container.appendChild(hostElement);
if (!location) { if (!location) {