2017-07-31 70 views
1

我得到一個錯誤:角材料設計 - 進口元素的錯誤

Uncaught Error: Unexpected directive 'MdRadioGroup' imported by the module 'AppModule'. Please add a @NgModule annotation 

在文件app.module我:

import { 
    MATERIAL_COMPATIBILITY_MODE, 
    MdRadioGroup, 
    MdButtonModule, 
} from '@angular/material'; 

及以下部分@NgModule

imports: [ 
    MdRadioGroup 
] 

但它不起作用

+1

角料2我把它? –

+0

是的,我從'from'@ angular/material'導入;' – Daniel

+0

在package.json中:'「@ angular/material」:「^ 2.0.0-beta.8」,' – Daniel

回答

2

導入模塊:

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

然後在@NgModules:

imports: [ 
... 
    MdRadioModule, 
... 
]