shlomiassaf / ngx-modialog

Modal / Dialog for Angular
http://shlomiassaf.github.io/ngx-modialog
MIT License
686 stars 242 forks source link

Not Assignable to parameter of type 'ContainerContent' #187

Closed stevewarsa closed 8 years ago

stevewarsa commented 8 years ago

http://embed.plnkr.co/7c0pGE/

NO

Error - [ts] Argument of type 'typeof ...Component' is not assignable to parameter of type 'ContainerContent'. Type 'typeof ...Component' is not assignable to type 'TemplateRef'. Property 'elementRef' is missing in type 'typeof ...Component'.

Just trying to follow the plunker which was set up: http://embed.plnkr.co/7c0pGE/

I'm very curious about this line in app.component.ts: return this.modal.open(CustomModal, overlayConfig);

Specifically the 'CustomModal' param to the open method. Why is it just the name of the Component class? This is not working for me, but I'm just trying to understand that. I created my component with angular-cli and it has all the code as in the sample in that plunker - just the name changed:

implements CloseGuard, ModalComponent

Anyway, now I'm trying to figure out how to get a TemplateRef to pass in there, since I thought I might be able to get that from my component.

Anyway, if I'm off my rocker here, you can just disregard this. It is late on a Friday and I may just be missing something obvious :) Have a great weekend.

angular-cli: 1.0.0-beta.11-webpack.8

stevewarsa commented 8 years ago

This was resolved by modifying the following files in :

token.d.ts: export declare type ContainerContent = string | TemplateRef | any | any[];

overlay.component.d.ts: getProjectables(content: string | TemplateRef | any | any[], bindings?: ResolvedReflectiveProvider[]): any[][];

modal.d.ts: protected createContainer(dialogRef: DialogRef, ContainerComponent: Class, content: string | TemplateRef | any[] | any, bindings?: ResolvedReflectiveProvider[]): ComponentRef;