Hey Massimiliano,
trying to answer your questions :
- How I can programmatically setup a binding with the Components that I
have instantiated ?
All the methods loadAsRoot, loadIntoLocation, loadNextToLocation are
promises that resolve to a reference to the component you just loaded
dynamically.
So, let's assume this is your dynamic Component
@Component({
template : '{{text}}' // This will print 'My dynamic text' defined below
})
class MyDynamicClass {
text: string;
}
Then you can set a value for 'text' property by using the reference
// ...
dcl.loadIntoLocation(MyDinamicClass, elementRef, anchor).then((componentRef)
=> {
componentRef.instance.text = 'My dynamic text';
});
-How I can organize the loaded component on a layout? currently my main
template is just this line of code : <div #snapin> </div>
I'm not really sure if I understood this question. How you organize your
layout is up to you. You can have things like this
<div #snapin>
<div #anothersnapin></div>
<div #sibling>
<div #children></div>
</div>
</div>
And you can load into those locations by using
dcl.loadIntoLocation(MyDinamicClass, elementRef, 'snapin').then((
componentRef) => {...});
dcl.loadIntoLocation(MyDinamicClass, elementRef, 'anotherspin').then((
componentRef) => {...});
dcl.loadIntoLocation(MyDinamicClass, elementRef, 'sibling').then((
componentRef) => {...});
dcl.loadIntoLocation(MyDinamicClass, elementRef, 'children').then((
componentRef) => {...});
// etc...
--
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.