Angular 添加未定义的FlexLayoutModule

Angular 添加未定义的FlexLayoutModule,angular,Angular,我正试图将FlexLayoutModule添加到项目中,但在控制台中它显示为未定义 我验证了它是否已正确安装,并且可以在我的nodemodules文件夹中看到它。以下是我的ng.module.ts的外观: import {BrowserModule} from '@angular/platform-browser'; import {NgModule} from '@angular/core'; import {FormsModule, ReactiveFormsModule} from '@a

我正试图将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()


有什么想法吗?

问题在于导入路径不正确。

您是否在system.config.js中添加了类似于“@angular/flex layout”:“npm:@angular/flex layout/bundles/*.umd.js”的映射依赖项?我对angular 2还比较陌生,正在转换表单1.x。我使用@angular/cli来构建项目。我在项目根目录或子文件夹中看不到system.config.js…请尝试不使用.forRoot(),这些不再需要。考虑到你的包裹是最新的,谢谢。问题在于FlexLayoutModule未定义。因此,消除这一问题仍然存在。