Hello,
I followed the installation manual for angular-cli but I can not import the module into my application. I get the following error:
Unexpected value 'undefined' imported by the module 'AppModule'
If I put it in the module where I'm going to use it, it also gives me a similar error.
packge.json dependecies:
"dependencies": {
"@angular/cli": "1.0.2",
"@angular/compiler-cli": "^4.0.0",
"@angular/animations": "^4.0.0",
"@angular/material": "^2.0.0-beta.5",
"@angular/common": "^4.0.0",
"@angular/compiler": "^4.0.0",
"@angular/core": "^4.0.0",
"@angular/flex-layout": "^2.0.0-beta.8",
"@angular/forms": "^4.0.0",
"@angular/http": "^4.0.0",
"@angular/platform-browser": "^4.0.0",
"@angular/platform-browser-dynamic": "^4.0.0",
"@angular/router": "^4.0.0",
"@swimlane/ngx-datatable": "^9.2.0",
"angular-load": "^0.5.0",
"core-js": "^2.4.1",
"ng2-bs3-modal": "^0.10.4",
"rxjs": "^5.1.0",
"zone.js": "^0.8.4"
},
"devDependencies": {
"@ng-bootstrap/ng-bootstrap": "^1.0.0-alpha.26",
"@types/jasmine": "2.5.38",
"@types/node": "~6.0.60",
"@types/systemjs": "^0.20.2",
"autoprefixer": "^6.5.3",
"codelyzer": "~2.0.0",
"css-loader": "^0.27.3",
"cssnano": "^3.10.0",
"exports-loader": "^0.6.3",
"file-loader": "^0.10.0",
"istanbul-instrumenter-loader": "^2.0.0",
"jasmine-core": "~2.5.2",
"jasmine-spec-reporter": "~3.2.0",
"json-loader": "^0.5.4",
"karma": "~1.4.1",
"karma-chrome-launcher": "~2.0.0",
"karma-cli": "~1.0.1",
"karma-coverage-istanbul-reporter": "^0.2.0",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"karma-requirejs": "^1.1.0",
"karma-sourcemap-loader": "^0.3.7",
"karma-webpack": "^2.0.3",
"less-loader": "^4.0.2",
"postcss-loader": "^1.3.3",
"postcss-url": "^5.1.2",
"protractor": "~5.1.0",
"raw-loader": "^0.5.1",
"sass-loader": "^6.0.3",
"script-loader": "^0.7.0",
"source-map-loader": "^0.1.5",
"style-loader": "^0.13.1",
"stylus-loader": "^3.0.1",
"ts-node": "~2.0.0",
"tslint": "~4.5.0",
"typescript": "~2.2.0",
"url-loader": "^0.5.7",
"webpack": "2.2.1",
"webpack-dev-server": "~2.4.2"
}
Thanks.
I have the same issue +1
can you show how are you importing the module?
Sorry for de delay
import { BrowserModule } from '@angular/platform-browser';
import { NgModule, CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { HttpModule } from '@angular/http';
import { NgModuleFactoryLoader } from '@angular/core';
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
import { AppComponent } from './app.component';
import { DashboardComponent } from './components/dashboard/dashboard.component';
import { Ng2Bs3ModalModule } from 'ng2-bs3-modal/ng2-bs3-modal';//M贸dulo para mostrar modales de bootstrap
import { AppRoutingModule } from './app-routing.module';
import { MdSidenavModule, MdToolbarModule, MdButtonModule, MdIconModule, MdInputModule } from '@angular/material';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { MdDatatableComponent } from './components/md-datatable/md-datatable.component';
import { BreadCrumbComponent } from './components/bread-crumb/bread-crumb.component';
import { TopBarModule } from './components/top-bar/top-bar.module';
import { LoginModule } from 'app/components/login/login.module';
import { FlexLayoutModule } from "@angular/flex-layout";
@NgModule({
declarations: [
AppComponent,
DashboardComponent
],
imports: [
BrowserModule,
TopBarModule,
FormsModule,
HttpModule,
AppRoutingModule,
Ng2Bs3ModalModule,
NgbModule.forRoot(),
MdSidenavModule,
MdToolbarModule,
MdButtonModule,
MdToolbarModule,
LoginModule,
MdIconModule,
BrowserAnimationsModule,
MdInputModule,
FlexLayoutModule
],
bootstrap: [AppComponent],
schemas: [CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA]
})
export class AppModule { }
If I import it into another module, the error is similar.
I've left it as impossible.
@patapron Hi, I faced the same problem with importing FlexLayoutModule. Below is workaround
Are you loading lazy module ?
If you are loading lazy module then you have to import FlexLayoutModule in your lazy module.
Reopened to add ^ info to the Wiki docs.
Sorry, I tried, but I do not know how to import the module with lazy load in my webpack config, besides I do not understand why I have to do it there.
@patapron , just import FlexLayoutModule in the module you're lazy loading.
@Juliano I can't load it lazy load with webpack, can you give me a hand? please.
@ggarg2 Please, can you help me with the webpack lazy load. I don't understand it very well. Thanks
Fortunately, I have a partner who knows webpack and has found a much simpler solution to use the library when loading modules with lazy load. Importing the library like this:
import { FlexLayoutModule } from "@angular/flex-layout/flexbox/_module";
Only this in your module and MAGIC.
Thank you all.
@patapron When I import it into my lazily loaded module I simply needed to import it like it says in the docs and shown below.
I don't see how any of your webpack configuration should matter specifically for this. The above import might work right now but break in a future version of this library if that module is moved inside the library for some reason.
import { FlexLayoutModule } from '@angular/flex-layout';
@NgModule({
imports: [
FlexLayoutModule,
// other imports
],
exports: [],
declarations: [],
providers: [],
})
export class LazyModule { }
Beta.8 source have some issues with Angular 4.1.x or higher and AOT. This PR #342 provides fixes to fully support Angular 4.x, AOT, FESM, and more.
I have that issue and I am running angular 6.1.7 and @angular/flex-layout 6.0.0-beta.18
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
_This action has been performed automatically by a bot._
Most helpful comment
Each feature module needs to import FlexLayoutModule (if those features use the flex-layout API) or import the shared module.