Skip to content

Problem with @NgModule Decorator while importing Modules from other project #298

@tkarzewski

Description

@tkarzewski

Cool Scaffold you built there! I like :-)

Unfortunately I am facing problems when I want to develop and import several projects and got this error: bundle() requires a decorated NgModule as its first argument.
For example I have a project my-shared-app with a ListComponent. I want to use this ListComponent in my project my-main-app.

my-main-app -> my-shared-app

For local development I use npm link to link the repos, but for example purpose I created those repos:

In my-main-app I adjusted following files

vendor.js

import 'my-shared-app';

app.module.ts

import { NgModule } from 'ng-metadata/core';
import { AppComponent } from './app.component';
import { MySharedAppModule } from 'my-shared-app';

@NgModule( {
  imports: [
    MySharedAppModule
  ],
  declarations: [
    AppComponent
  ]
} )
export class MyMainAppModule {
}

app.component.js

import { Component } from 'ng-metadata/core';

@Component({
  selector: 'np-app',
  template: `
    <h1>Main Module</h1>
    <np-list [entries]="$ctrl.entries"></np-list>
  `
})
export class AppComponent {

  entries = [
    { id: 1, label: 'Entry 1' },
    { id: 2, label: 'Entry 2' },
    { id: 3, label: 'Entry 3' },
    { id: 4, label: 'Entry 4' },
  ]

}

Do you see, what I'm doing wrong? Any suggestions?
Thx for help! :-)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions