Giter Club home page Giter Club logo

Comments (19)

cankayacan avatar cankayacan commented on May 28, 2024 2

https://github.com/cankayacan/ng5-dynamic-component-test

Getting this error:

Error: Unexpected value '[object Object]' imported by the module 'AppModule'. Please add a @NgModule annotation.

from ng-dynamic-component.

gund avatar gund commented on May 28, 2024 1

Yes, I will prepare an upgraded version very soon.

from ng-dynamic-component.

nlgi avatar nlgi commented on May 28, 2024 1

Hi!

There is another bug with official release of Angular 5.

ERROR Error: Uncaught (in promise): Error: Unexpected value '[object Object]' imported by the module 'ImmeubleModule'. Please add a @NgModule annotation.

Indeed in dynamic.module.d.ts:

import { ComponentInjector } from './component-injector'; import { ModuleWithProviders, Type } from '@angular/core'; export declare class DynamicModule { static withComponents(components: Type<any>[], componentInjector?: Type<ComponentInjector>): ModuleWithProviders; }

No @NgModule annotation.

Many thanks,

from ng-dynamic-component.

gund avatar gund commented on May 28, 2024 1

Hey, you will not see any annotations in the *.d.ts files - those are just for typescript compiler not runtime.
I guess this problem happens because I build it with RC5 and you are trying with actual release v5.

I will publish stable version with v5 so you can try it

from ng-dynamic-component.

rbleuse avatar rbleuse commented on May 28, 2024 1

Hello,

I still get the error message ERROR Error: Unexpected value '[object Object]' imported by the module 'MonthlyBonusModule'. Please add a @NgModule annotation.

Using ng5 - dynamic 2.0.1 & cli 1.5

from ng-dynamic-component.

shlomiassaf avatar shlomiassaf commented on May 28, 2024 1

very simple, use [email protected] not 2.5.3

The problem is angular not notifying about it

from ng-dynamic-component.

shlomiassaf avatar shlomiassaf commented on May 28, 2024 1

I don't know...
They know about it so work is on way...

The issues are with tsickle mostly, not emitting the decorators... other then that you can AOT compile an app and it will work...

Since it's one shot compile the data is kept

from ng-dynamic-component.

gund avatar gund commented on May 28, 2024

Hey there!

Just published new next version of lib under next tag in NPM so you can go ahead and try it out:

$ npm install ng-dynamic-component@next

All changes are currently in separate next branch - until Angular 5 will be officially released.

from ng-dynamic-component.

gund avatar gund commented on May 28, 2024

Hmm... I will try on a sample app later.
Thanks for reporting, reopening issue.

from ng-dynamic-component.

nlgi avatar nlgi commented on May 28, 2024

Yes, same for me. Good luck!

from ng-dynamic-component.

lukaszbachman avatar lukaszbachman commented on May 28, 2024

I ran into the same issue today using CLI 1.5, NG 2.1 and ng-dynamic-component 2.0.1, like all the others.
I compared the generated JS bundle for ng-dynamic-component and another open source library which is not triggering exceptions just to find that the generated class does contain additional metadata.

TooltipModule.decorators = [
        { type: NgModule, args: [{
                    imports: [CommonModule],
                    declarations: [TooltipDirective, TooltipContainerComponent],
                    exports: [TooltipDirective],
                    entryComponents: [TooltipContainerComponent]
                },] },
    ];

This decorators property is not present in case of generated DynamicModule, so I bet that this is what's causing NG to error out. I'm not sure though why this happens.

from ng-dynamic-component.

gund avatar gund commented on May 28, 2024

@lukaszbachman thanks for pointing to this, I will check why they are not appearing

from ng-dynamic-component.

gund avatar gund commented on May 28, 2024

Just confirmed that NGC does not generate metadata anymore for the project...
I guess it's because Angular v5 by default strips any angular specific decorators to optimize bundle.
Need to look for any config flags how to turn it off...

from ng-dynamic-component.

gund avatar gund commented on May 28, 2024

So I found this property called generateCodeForLibraries for angularCompilerOptions in tsconfig.json and I tried to set it to true and still did not get any decorators emitted...

Really weird.
Anyone has any idea what might be the issue?

from ng-dynamic-component.

elclanrs avatar elclanrs commented on May 28, 2024

@gund, this seems to be related angular/angular#20219

from ng-dynamic-component.

gund avatar gund commented on May 28, 2024

@elclanrs looks interesting but they are talking about code-gen of ngfactorys and here we are not generating them.
In our case there are not a single decorator being emitted by the NGC.

I just tried to use TSC with the same config and it did output all decorators - so it's purely NGCs issue now.

Trying to build a reproduction app now...

from ng-dynamic-component.

shlomiassaf avatar shlomiassaf commented on May 28, 2024

2.5.3 support can be tracked here angular/angular#20175

from ng-dynamic-component.

gund avatar gund commented on May 28, 2024

Hey @shlomiassaf thanks for the info. Just tried with TS v2.4 and it did work.

Angular team already knows about the problem with decorators in TS v2.5 or it makes sense to create a repro app and link to the issue?

from ng-dynamic-component.

gund avatar gund commented on May 28, 2024

You can try v2.0.2 - should be fixed

from ng-dynamic-component.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.