Angular2 Component ElementRef not working
<p>I would like to create a component in Angular 2 where I can pass in values from the HTML. I thought I would use <code>ElementRef</code>, but I can't seem to reference it without errors.</p>

<p>Here is my code:</p>

<pre><code>import { Component, ElementRef } from '@angular/core';
@Component({
    selector: 'my-app',
    template: `
    &lt;p&gt;Hello World&lt;/p&gt;
    `
})
export class MyAppComponent {
    constructor(private el: ElementRef) {}
    ngOnInit() {
        this.el.nativeElement.style.backgroundColor = 'red';
    }
}
</code></pre>

<p>This code is just for testing if I can control or at least check the dom element of the component, but it doesn't work.</p>

<p>Later I want to be able to get variables from the HTML like</p>

<pre><code>&lt;my-app variable="value"&gt;&lt;/my-app&gt;
</code></pre>

<p>The error I am getting is</p>

<pre><code>Unhandled Promise rejection: Can't resolve all parameters for MyAppComponent: (?). ; Zone: &lt;root&gt; ; Task: Promise.then ; Value: Error: Can't resolve all parameters for MyAppComponent: (?).
</code></pre>

<p>I am using the recently released 2.0.0 version (not rc)</p>