I am using the following:
this.DynamicComponentLoader.loadIntoLocation(NewComponent, this.parent, 'new');
where this.parent is an ElementRef of my main class App.
However, this throws me an error of:
TypeError: Cannot read property 'componentView' of undefined.
I create this.parent like that:
setParent(parent){
    this.parent = parent.nativeElement;
}
and my App class:
export class App{
    constructor(_elementRef:ElementRef){
        Service.setParent(_elementRef);
    }
}
And my NewComponent:
import {Component} from "angular2/core";
@Component({
    selector: 'new',
    templateUrl: 'app/New.html'
})
export class NewComponent{
    constructor(){
        console.log("New Comopnent here")
    }
}
and Service:
export class Service{
    private parent:ElementRef;
    constructor(private DynamicComponentLoader:DynamicComponentLoader){
    }
    setParent(parent){
        this.parent = parent.nativeElement;
    }
    append(){
        this.DynamicComponentLoader.loadIntoLocation(ModalComponent, this.parent, 'modal');
    }
}
Any ideas on where is the problem?
 
    