Inyectando ElementRef al error inyectable
Tengo un problema con la inyecciónElementRef
para miInjectable
. Aquí está mi código:
import {Injectable, DynamicComponentLoader, ElementRef, Inject} from "angular2/core";
import {Modal} from './Modal';
@Injectable()
export class ModalService{
constructor(public _dcl:DynamicComponentLoader, public _el:ElementRef){
}
createModal(parent){
this._dcl.loadIntoLocation(Modal,this._el, 'modal')
}
}
MiModal
:
importar {Componente} desde "angular2 / core";
@Component({
selector: 'modal',
templateUrl: 'app/common/modal/Modal.html'
})
export class Modal{
constructor(){
}
}
Esto me lleva al siguiente error:
No hay proveedor para ElementRef! (HomeComponent -> ModalService -> ElementRef)
¿Por qué?