Promact / md2

Angular2 based Material Design components, directives and services are Accordion, Autocomplete, Collapse, Colorpicker, Datepicker, Dialog(Modal), Menu, Multiselect, Select, Tabs, Tags(Chips), Toast and Tooltip.
http://code.promactinfo.com/md2/
MIT License
379 stars 111 forks source link

Cannot find module 'md2' #251

Closed saschwarz closed 7 years ago

saschwarz commented 7 years ago

Bug, feature request, or proposal:

I'm trying to use md2 in an Ionic/Angular 4 webpack application.

What is the expected behavior?

Import md2 without an error.

What is the current behavior?

I followed the install instructions:

Ran: npm install md2 --save and added import to my app.module.ts

But I didn't add to systemjs.config.js since that doesn't seem to exist in Angular4 projects.

When typescript compiles it can't find the module.

[08:09:57]  typescript: src/app/app.module.ts, line: 19 
            Cannot find module 'md2'. 
      L19:  import { Md2Module }  from 'md2';

What are the steps to reproduce?

Providing a Plunker (or similar) is the best way to get the team to see your issue. Plunker template: http://plnkr.co/edit/rQmUz8WYRh5Vz4gwY8E4?p=info

What is the use-case or motivation for changing an existing behavior?

Which versions of Angular, MD2, OS, browsers are affected?

Is there anything else we should know?

dharmeshpipariya-zz commented 7 years ago

@saschwarz could you explain configurations of your app in detail or share sample code of it?

saschwarz commented 7 years ago

Using https://github.com/johnpapa/angular-tour-of-heroes and following the md2 install instructions I had to also install angular animations:

npm install @angular/animations --save

So now I get:

ERROR in /Users/saschwarz/dev/angular-tour-of-heroes/src/app/app.module.ts (21,15): Property 'forRoot' does not exist on type 'typeof Md2Module'.

ERROR in Error encountered resolving symbol values statically. Calling function 'Md2Module', function calls are not supported. Consider replacing the function or lambda with a reference to an exported function, resolving symbol AppModule in /Users/saschwarz/dev/angular-tour-of-heroes/src/app/app.module.ts, resolving symbol AppModule in /Users/saschwarz/dev/angular-tour-of-heroes/src/app/app.module.ts
webpack: Failed to compile.
dharmeshpipariya-zz commented 7 years ago

@saschwarz yes, we have removed forRoot from md2module, use to import the only Md2Module in your project, we will update documentation.