import {Component, Inject, ElementRef} from 'angular2/core';
declare var ol: any;
@Component({
selector: 'olmap'
})
export class MapComponent {
elementRef: ElementRef;
constructor(@Inject(ElementRef) elementRef: ElementRef){
this.elementRef = elementRef;
}
}
constructor(private elementRef: ElementRef){}
(or `public` instead of `private`)
Your problem is outside of the code your provided.
Does your component not have a `template` or is this just because you shortened the code before posting?
Forgot bindings:
import {Component, Inject, ElementRef} from 'angular2/core';
declare var ol: any;
@Component({
selector: 'olmap',
bindings: [ElementRef]
constructor(public elementRef: ElementRef){}