I have exactly the same problem. All what I want is to generate the 
template of a component dynamically. When I do it via loadIntoLocation how 
do I pass input bindings etc. and it feels rather messy (for a simple 
problem).

Am Montag, 21. Dezember 2015 23:57:25 UTC+1 schrieb Manfred Steyer:
>
> Hi Eric,
>
> now, I've looked into this and I have 2 questions:
>
> 1. The following sample creates a new Component-Instance with 
> loadIntoLocation and assignes a model to it. But how to set up bindings 
> (property, event, two-way)?
>
> this.loader.loadIntoLocation(DynamicComponent, this.element, 'attach')
>     then((res) => {res.instance.model = model; this.savedComp = res;});
>
> 2. The solution at the end of [1] declares a CompiledComponent-Class 
> within the constructor. Somehow, that looks like a work-around. Is there an 
> other solution for this?
>
> [1] 
> http://stackoverflow.com/questions/32340641/angular-2-equivalent-of-ng-bind-html-sce-trustashtml-and-compile/32341540#32341540
>
> Wishes,
> Manfred
>
> Am Samstag, 19. Dezember 2015 20:12:08 UTC+1 schrieb Manfred Steyer:
>
>> Thanks for the hint!
>>
>> Best wishes,
>> Manfred
>>
>> Am Freitag, 18. Dezember 2015 21:45:43 UTC+1 schrieb Eric Martinez:
>>
>>> Manfred,
>>>
>>> you are looking for DynamicComponentLoader 
>>> <https://angular.io/docs/ts/latest/api/core/DynamicComponentLoader-class.html>.
>>>  
>>> You can check these questions to see some usage of it in SO 
>>> http://stackoverflow.com/search?tab=relevance&q=dynamiccomponentloader
>>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to angular+unsubscr...@googlegroups.com.
To post to this group, send email to angular@googlegroups.com.
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to