If possible, I would add the field to ChildComponent and ChildComponent id to it:
@Component({ selector: 'child-component', host: {'[id]': 'id'} }) class ChildComonent { id:string; }
this._loader.loadIntoLocation(ChildComponent,this._elementRef,'child') .then(cmp => cmp.instance.id = 'someId');
See also http://plnkr.co/edit/ihb7dzRlz1DO5piUvoXw?p=preview#
A more hacker way would be
this.dcl.loadIntoLocation(Dynamic, this.ref, 'child').then((cmp) => { cmp.location.nativeElement.id = 'someId'; });
Instead of directly accessing nativeElement properties, nativeElement should do the same with Renderer .
source share