Error: Unexpected value 'undefined' exported by the module 'DynamicFormModule'
Asked Answered
B

7

14

Angular2 has an ability to generate forms dynamically (Model driven forms) as opposed to manually building the form (template driven).

I have a variation of Dynamic forms in which the entire Form generation functionality is exposed as a module (Angular RC5).

But it breaks with the following error (appears in Dev console)

VM849:20 Error: Error: Unexpected value 'undefined' exported by the module 'DynamicFormModule'

Here's the plunkr

Dynamic Form as a Module Plunkr

Bipartite answered 26/8, 2016 at 19:5 Comment(0)
B
3

Fixed it. There was a typo for DynamicFormComponent. It was spelled as DynamicForm. Corrected it in dynamic-form.module.ts

Bipartite answered 30/8, 2016 at 3:8 Comment(0)
P
9

Had a similar error. Discovered it was caused by a repeated export in one of my index.ts file:

export * from './article/article.component';
export * from './body/body.component'; //first export
export * from './cards/cards.component';
export * from './body/body.component'; //repeated export
Prologize answered 23/4, 2017 at 18:21 Comment(1)
It helped me. Thanks!Wolfish
B
3

Fixed it. There was a typo for DynamicFormComponent. It was spelled as DynamicForm. Corrected it in dynamic-form.module.ts

Bipartite answered 30/8, 2016 at 3:8 Comment(0)
A
3

Had a similar error. It was caused by an import in the NgModule of my library. Instead of importing it directly, it was imported from the public_api.ts file (entry file).

Fixed it by changing

import { MyDirective } from 'public_api';

to

import { MyDirective } from './my-directive/my-directive.directive';

Amand answered 18/10, 2018 at 9:41 Comment(0)
T
1

I had the same error. I fixed it by replacing

export * from './myComponent'

by

export {MyComponent} from './myComponent'
Twopiece answered 6/9, 2016 at 7:43 Comment(0)
P
1

I got the fix for this from here(https://techoverflow.net/2018/09/19/fixing-angular-error-unexpected-value-undefined-declared-by-the-module/) and it worked for me. Trailing coma in my component metadata caused this.

Personality answered 9/12, 2019 at 5:54 Comment(0)
D
0

In my case, it was because I had created a route file in a child module "A", but didn't import that route file in the root module, even though child module "A" was imported into the root module.

import { A } from 'src/app/module-a/a.module'; import { ARoutes } from 'src/app/module-a/a.routes'; // this was missing in my root app modules

Dextrorse answered 7/1, 2019 at 20:47 Comment(0)
E
0

I’m stunned by the impact of the extra comma in my situation.

@NgModule({
  imports: [
    CommonModule,
    ...
  ],
  declarations: [
    AComponent,,
    BComponent,
  ],
  exports: [
    AComponent,,
    BComponent,
  ],
  entryComponents: [
  ],
  providers: []
...
Esperanzaespial answered 9/7, 2024 at 9:11 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.