Skip to content

Instantly share code, notes, and snippets.

@SpeedoPasanen
Created July 24, 2017 11:25
Show Gist options
  • Save SpeedoPasanen/13cc290d7ee91863b556fcfdfa06274c to your computer and use it in GitHub Desktop.
Save SpeedoPasanen/13cc290d7ee91863b556fcfdfa06274c to your computer and use it in GitHub Desktop.
Angular-cli doesn't resolve those arrays before @NgModule, although commented out code works with JIT
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { ScrollAreaComponent } from '../components/scroll-area/scroll-area.component';
import { FormsModule } from '@angular/forms';
import { MaterialModule, MdNativeDateModule } from '@angular/material';
import { SpinnerComponent } from '../components/spinner/spinner.component';
import { PromptComponent } from '../components/prompt/prompt.component';
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
/*
Compiler doesn't appear to resolve these and you get "Cannot determine the module for class PromptComponent", etc. for all components.
const imports: any[] = [
CommonModule,
NgbModule.forRoot()
];
const exportz: any[] = [
NgbModule
];
const declareAndExport = [
ScrollAreaComponent,
SpinnerComponent,
PromptComponent,
];
const importExport = [
FormsModule,
MaterialModule,
MdNativeDateModule
];
*/
@NgModule({
imports:
//imports.concat(importExport),
[
CommonModule,
NgbModule.forRoot(),
FormsModule,
MaterialModule,
MdNativeDateModule
],
declarations: [
ScrollAreaComponent,
SpinnerComponent,
PromptComponent,
]
// .concat(declareAndExport)
,
exports:
//exportz
/// .concat(importExport)
// .concat(declareAndExport)
[
CommonModule,
NgbModule,
FormsModule,
MaterialModule,
MdNativeDateModule,
ScrollAreaComponent,
SpinnerComponent,
PromptComponent,
],
entryComponents: [PromptComponent]
})
export class SharedModule {
}
@starbugs2008
Copy link

I encountered same problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment