Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

warning : export 'ModalTemplate' was not found in 'ng2-semantic-ui' #171

Closed
dev-fullstacktechnology opened this issue Jul 13, 2017 · 9 comments

Comments

@dev-fullstacktechnology
Copy link

dev-fullstacktechnology commented Jul 13, 2017

Bug description: importing ModalTemplate cause warning for

export 'ModalTemplate' was not found in 'ng2-semantic-ui'

I had this error when I am using template based modal method for dialog.
I am not getting this type of error in plunker so I was putting snapshot of my project code.

screenshot_1

Version of Angular, ng2-semantic-ui, Semantic UI

Angular: 4.2.2
ng2-semantic-ui: 0.8.2
Semantic UI: 2.2.2

I looked on internet but there is no such answer found for my solution.

Send me a reply if you need any other detail related to issue.

@sumitridhal
Copy link

sumitridhal commented Jul 13, 2017

@edcarroll This is a great project, thanks for all your hard work.

I'm getting the same error.

@edcarroll
Copy link
Owner

This is a webpack issue due to the fact that interfaces in Typescript are erased upon compilation.

A workaround (for now) is to make a new file called modal-template.ts (or anything you like) that has the contents:

import {ModalTemplate} from "ng2-semantic-ui";

export {ModalTemplate};

Then whenever you need ModalTemplate just import it from this new file (called a barrel).

I'll try to get a fix for this sorted next week, am currently on holiday so a workaround will have to do for now :)

@sumitridhal
Copy link

sumitridhal commented Jul 13, 2017

@edcarroll Thanks a lot 👍
Changes:
File: node_modules\ng2-semantic-ui\dist\modules\modal\classes\modal-template.ts

export declare class ModalTemplate<T, U = undefined, V = undefined> {
    context: T;
    constructor(context: T);
}

File: node_modules\ng2-semantic-ui\dist\modules\modal\index.js
Added : export * from "./classes/modal-template";

File: node_modules\ng2-semantic-ui\dist\modules\modal\public.js

Added: export { ...., ModalTemplate } from "./index";

Working fine for me.

@dev-fullstacktechnology
Copy link
Author

dev-fullstacktechnology commented Jul 14, 2017

Thanks for solutions. I will check for that solution. And one more thing is we don't have one type of multi select drop down is available. Do I need to open a new issue?

@edcarroll
Copy link
Owner

@dev-fullstacktechnology apologies, can't work out what you mean by your last message, is there a specific style of multi select not working?

edcarroll added a commit that referenced this issue Jul 19, 2017
This stops it from being erased by Typescript, so when people use it in decorators it still exists. Closes #171
edcarroll added a commit that referenced this issue Jul 19, 2017
This stops it from being erased by Typescript, so when people use it in decorators it still exists. Closes #171
@edcarroll
Copy link
Owner

edcarroll commented Jul 19, 2017

0.9.3 is now live with a fix for this. This was actually happening due to how decorators are compiled into JS, since when you annotate something it keeps its type ready to be accessed. Since ModalTemplate was a type, it was erased and so didn't exist at runtime. I've changed ModalTemplate to be an abstract class so that it still exists at runtime and no longer will cause this warning. Thanks for your patience!!

@dev-fullstacktechnology
Copy link
Author

dev-fullstacktechnology commented Jul 21, 2017

This is the snippet for I want feature available in our project.
screenshot_2
When I select multiple option from drop down it will show selected option with dark and only count of them is displaying on label box. So, we have multiple selection drop down feature allow to use where lake of space is there.
Let me know if you make another Issue for this feature or I can say improvement.

@edcarroll
Copy link
Owner

@dev-fullstacktechnology I see what you mean, essentially an option for it to not remove the labels from the list.

Could you please open a separate issue as a feature request so I can track it there and get it into a release?

@dev-fullstacktechnology
Copy link
Author

ok, That is good for us

gotenxds pushed a commit to gotenxds/ng2-semantic-ui that referenced this issue Aug 15, 2017
This stops it from being erased by Typescript, so when people use it in decorators it still exists. Closes edcarroll#171
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants