将FlexLayoutModule添加为未定义

时间:2017-03-14 19:13:34

标签: angular

我试图将FlexLayoutModule添加到项目中,但它在控制台中未定义。

我验证了安装正确,我可以在nodemodules文件夹中看到它。这是我的ng.module.ts的样子:

import {BrowserModule} from '@angular/platform-browser';
import {NgModule} from '@angular/core';
import {FormsModule, ReactiveFormsModule} from '@angular/forms';
import {HttpModule} from '@angular/http';
import {MaterialModule} from '@angular/material';
import {FlexLayoutModule} from '@angular/flex-layout';

import {AppRoutingModule} from './app-routing.module';

import 'hammerjs';

/*----------  MODULES  ----------*/

export const modules = [
  BrowserModule,
  FormsModule,
  ReactiveFormsModule,
  HttpModule,
  MaterialModule.forRoot(),
  FlexLayoutModule.forRoot(),
  AppRoutingModule
];

/*----------  COMPONENTS  ----------*/

import {AppComponent} from './app.component';
import {TopNavComponent} from './core/top-nav/top-nav.component';
import {NotificationsComponent} from './core/notifications/notifications.component';
import {ProfileComponent} from './profile/profile.component';
import {PageTitleComponent} from './shared/page-title/page-title.component';
import {SettingsComponent} from './settings/settings.component';
import {UserEditorComponent} from './settings/users/user-editor/user-editor.component';
import {UsersComponent} from './settings/users/users.component';
import {DeleteUserDialogComponent} from './settings/users/delete-user-dialog/delete-user-dialog.component';
import {TagsComponent} from './settings/tags/tags.component';


export const components = [
  AppComponent,
  TopNavComponent,
  ProfileComponent,
  NotificationsComponent,
  ProfileComponent,
  PageTitleComponent,
  SettingsComponent,
  UsersComponent,
  UserEditorComponent,
  DeleteUserDialogComponent,
  TagsComponent
];

/*----------  SERVICES  ----------*/

import {NotificationsService} from './core/notifications/notifications.service';
import {UsersService} from './settings/users/users.service';
import { CaseNavComponent } from './settings/case-nav/case-nav.component';

export const services = [
  NotificationsService,
  UsersService
];

@NgModule({
  declarations: [...components, CaseNavComponent],
  imports: [...modules],
  providers: [...services],
  entryComponents: [DeleteUserDialogComponent], // for angular material 2
  bootstrap: [AppComponent]
})
export class AppModule {
}

我在控制台中遇到的错误是模块的常量数组中的这行是未定义的,尽管我明确地导入了它:FlexLayoutModule.forRoot(),

有什么想法吗?

1 个答案:

答案 0 :(得分:0)

问题是导入路径不正确。