I've followed the example in the documentation, and get "Error: No provider for ElementRef!". It works fine when using ElementRef in an @Component. All I'm adding is the ElementRef and Renderer (renderer does not have a problem):
import { Directive, AfterViewInit, ElementRef, Renderer} from '@angular/core';
export class blah implements AfterViewInit {
constructor(private el: ElementRef, private renderer: Renderer) { }
ngAfterViewInit() {
...
Nothing I tried worked at all, so I took the example from the documentation, https://angular.io/docs/ts/latest/guide/attribute-directives.html, and put it in the quickstart (with systemJS). It worked fine. When I migrate that to the webpack configuration https://angular.io/docs/ts/latest/guide/webpack.html, it worked fine. The angular2 application that has the issue is much more complex, but I don't know what would cause this.