ng-dynamic-component
ng-dynamic-component copied to clipboard
Can't bind to 'ndcDynamicInputss' since it isn't a known property of 'ndc-dynamic'.
Hello,
I'm getting the errors :
Can't bind to 'ndcDynamicInputs' since it isn't a known property of 'ndc-dynamic'.
and
Can't bind to 'ndcDynamicOutputs' since it isn't a known property of 'ndc-dynamic'.
when I add the [ndcDynamicInputs] and [ndcDynamicOutputs] inputs binding to <ndc-dynamic></ndc-dynamic>.
My template : <gridster-item [item]="widget.disposition" *ngFor="let widget of widgets"> <ndc-dynamic [ndcDynamicComponent]="widget.component" [ndcDynamicInputs]="widget.inputs" [ndcDynamicOutputs]="widget.outputs"> </ndc-dynamic> </gridster-item>
The module imports :
imports: [ CommonModule, .... , DynamicComponentModule, DynamicIoModule, DynamicModule ],
Angular 9.1.6 ng-dynamic-component 6.1.0
I also tried with <ng-template> and <ng-container> methods, same result ...
What's wrong ?
Thanks a lot
Hi, please create a reproduction online on stackblitz so I can see and verify it. Otherwise I'm not able to help.
hi Guys,
i got the same issue... impossible to load [ndcDynamicInputs] & [ndcDynamicOutputs]
angular 9.1.9 with nx
@NgModule({ imports: [ DynamicModule.forRoot(),DynamicIoModule, DynamicComponentModule ], exports: [ DynamicPanelComponent
], declarations: [DynamicPanelComponent] }) export class SharedUtilityModule {}
tried also in app.module.ts same result
tried all 3 methods
<ndc-dynamic [ndcDynamicComponent]="panelService.panelComponent | async" (ndcDynamicCreated="")>
<ng-template [ngComponentOutlet]="panelService.panelComponent | async"></ng-template>
<ng-container *ngComponentOutlet="panelService.panelComponent | async;"></ng-container>
can not use in the tree methods...
Any idea,
very big thanks
When I try to import DynamicIoModule in app.module.ts, I get "Class DynamicIoModule is not an Angular module." Angular 6.0.7, ng-dynamic-component 6.1.0
@BluefishTom you cannot use v6 with Angular v6. Please read the readme file for more info.
My apologies, I meant Angular 9.0.7. I need to type more carefully.
Oh in that case I would also ask you to please prepare some online demo with the issue because I am not able to help you otherwise.
got the exact same problem in 6.1.0 and angular 9, it still compile but
<ng-template let-menu>
<div class="menu-container">
<ndc-dynamic
(ndcDynamicCreated)="componentCreated($event)"
[ndcDynamicComponent]="type"
[ndcDynamicInputs]="inputs" <= can't bind
[ndcDynamicOutputs]="outputs" <= can't bind
>
</ndc-dynamic>
</div>
</ng-template>
I am importing correctly
import { DynamicComponentModule, DynamicIoModule } from "ng-dynamic-component";
It still compile and don't crash, but the template file is always red with error.
I tried to make a stackblitz, but I can't manage to have it underline the errors.
If your app compiles and has no runtime errors it means that everything is correct and fine. This is most likely an issue with your IDE. Try restarting it. Sometimes opening the module file of the component helps IDE to analyze it.
Hi,
I'm currently facing the same issue. Im using Angular 9 with ng-dynamic-component 6.1.0.
<ndc-dynamic [ndcDynamicComponent]="currentComponent" [ndcDynamicInputs]="inputs" [ndcDynamicOutputs]="outputs"></ndc-dynamic>
I can't compile it as it shows "Can't bind to 'ndcDynamicOutputs' since it isn't a known property of 'ndc-dynamic'."
This is what I see when i go into the component
export declare class DynamicComponent implements OnChanges, DynamicComponentInjector {
private vcr;
private cfr;
ndcDynamicComponent: Type;
ndcDynamicInjector: Injector;
ndcDynamicProviders: StaticProvider[];
ndcDynamicContent: any[][];
ndcDynamicCreated: EventEmitter>;
componentRef: ComponentRef | null;
constructor(vcr: ViewContainerRef, cfr: ComponentFactoryResolver);
ngOnChanges(changes: SimpleChanges): void;
createDynamicComponent(): void;
private _resolveInjector;
}
There is no ndcDynamicInputs and ndcDynamicOutputs.
My problem was fixed when I used @no-barrels version ( 7.0.2-no-barrels.2)
@gund it does compile and have no error, but I am in the same situation with @leeus99 it shouldn't compile at all since the definition do not exist
ndc-dynamic is a component and ndcDynamicInputs is a directive so you will not see one in another's definition.
Again if your app does compile and there are no runtime errors - there is no problem with the library but with your dev IDE.
Also you might want to try @no-barrels NPM tag and see if the error in IDE goes away.
Try https://github.com/93Alliance/ngx-dyncmp
I'm having the same problem, and using the 7.0.2-no-barrels.2 version fixes it as well
npm i ng-dynamic-component@no-barrels
Perhaps no-barrels should be the main line?
Just to clarify is this issue also happening in the applications not just libraries?
I had the same issue, where everything works, but I have the error message mentioned in the title in my IDE (VSCode)
I don't think it's an issue with the project, because it compiles and runs fine, the error is only showing up in the IDE not during execution or when I compile. Maybe it's a problem with TSLint?
Installing the no-barrels version did solve the issue for me.
I suggest that this could be added to the ReadMe.
I'm closing this issue as it's outdated. If you want to reopen the discussion please feel free to open a new issue.