matInput指令在延迟加载的模块中不起作用

时间:2019-04-23 19:03:34

标签: angular

我已经创建了一个用于延迟加载的模块,该模块实际上可以正常工作,问题是由于某些原因,诸如matInput之类的模块无法正常工作。我的意思是说input看起来不漂亮。

MatInputModule相应地导入模块:

const routes = [
  {path: '', component: AddPlaceComponent}
];


const MaterialModules = [
  MatFormFieldModule,
  MatInputModule,
];

@NgModule({
  declarations: [    
    // Organisms
    PlaceAutocompleteComponent,    
    // Templates
    AddPlaceComponent,
  ],
  imports: [
    CommonModule,
    FormsModule, ReactiveFormsModule,
    RouterModule.forChild(routes),
    FlexLayoutModule,
    MaterialModules,
  ]
})
export class AddPlaceModule { }

需要PlaceAutocompleteComponent的{​​{1}}就这么简单:

input

仍然,控件如下所示:

enter image description here

我只是看不到。所有其他路线都在工作。延迟加载也可以正常工作,并且控制台中没有警告或错误。

我想念什么?

我认为这与延迟加载和/或路由有关吗?

1 个答案:

答案 0 :(得分:0)

matInputs应该在<mat-form-field><input matInput></mat-form-field>内使用