Jeanluca Scaljeri
Jeanluca Scaljeri

Reputation: 29109

How to setup angular 2 material design 2.0.0-beta.2

I'm trying to use angular material design (2.0.0-beta2), but I cannot get it to work. For example, if I try to use

<md-input-container>
    <input mdInput name="value">
</md-input-container>

With the following added to app.module.ts

    import {MaterialModule} from '@angular/material';

@NgModule({
    ...
    imports: [ MaterialModule, ...],
    ...
})

But I get the following error:

'md-input-container' is not a known element:

Note: The component using the above code lives somewhere in my app a couple of modules deep!

When I also add MdInputContainer to the declarations I get a different error:

Type MdInputContainer is part of the declarations of 2 modules: MdInputModule and AppModule!

I think I'm getting close, but I'm missing something, any help would be appreciated

Upvotes: 0

Views: 292

Answers (1)

Ron537
Ron537

Reputation: 990

In order to use angular material components you need to import the MaterialModule in the module you are using it. Importing it only from parent modules won't recognize it.

Upvotes: 1

Related Questions