When using <md-icon>
I get this error:
ORIGINAL EXCEPTION: No provider for Http!
So I added HTTP_PROVIDERS
to my component and it solved it. So my question... Why do I need to add HTTP_PROVIDERS
to my component to get <md-icon>
to work even though I'm not using HTTP_PROVIDERS
in my app otherwise?!
Here's my working component. Removing HTTP_PROVIDERS
from the providers array throws the above error.
import { Component } from '@angular/core';
import { HTTP_PROVIDERS } from '@angular/http';
import { MdIcon, MdIconRegistry } from '@angular2-material/icon';
@Component({
moduleId: module.id,
selector: 'foo-app',
template: `<md-icon>face</md-icon>`,
directives: [ MdIcon ],
providers: [MdIconRegistry, HTTP_PROVIDERS]
})
export class FooAppComponent {
title = 'Material 2 Foo App';
}
One other note, this line will display the icon with no Http error and no need for HTTP_PROVIDERS
:
<i class="material-icons">face</i>