kevinoleary19 / Angular-2-Datepicker

A minimalist datepicker inspired by Google's material design
70 stars 71 forks source link

angular 6 update issue #107

Open vardansafaryan0407 opened 6 years ago

vardansafaryan0407 commented 6 years ago

hi, after updating angular 6 I received current compile error`

ERROR in node_modules/angular2-material-datepicker/src/datepicker.component.ts(2,3): error TS2305: Module '"C:/xampp/htdocs/cyance/nexus/nexus-migrating/node_modules/@angular/core/core"' has no exported member 'animate'. node_modules/angular2-material-datepicker/src/datepicker.component.ts(2,56): error TS2305: Module '"C:/xampp/htdocs/cyance/nexus/nexus-migrating/node_modules/@angular/core/core"' has no exported member 'keyframes'. node_modules/angular2-material-datepicker/src/datepicker.component.ts(3,43): error TS2305: Module '"C:/xampp/htdocs/cyance/nexus/nexus-migrating/node_modules/@angular/core/core"' has no exported member 'state'. node_modules/angular2-material-datepicker/src/datepicker.component.ts(3,50): error TS2305: Module '"C:/xampp/htdocs/cyance/nexus/nexus-migrating/node_modules/@angular/core/core"' has no exported member 'style'. node_modules/angular2-material-datepicker/src/datepicker.component.ts(3,57): error TS2724: Module '"C:/xampp/htdocs/cyance/nexus/nexus-migrating/node_modules/@angular/core/core"' has no exported member 'transition'. Did you mean 'TRANSLATIONS'? node_modules/angular2-material-datepicker/src/datepicker.component.ts(3,69): error TS2305: Module '"C:/xampp/htdocs/cyance/nexus/nexus-migrating/node_modules/@angular/core/core"' has no exported member 'trigger'.

seems this is related to separating some modules from @angular/core

any hints how could this be solved?

Thanks in advance

humblepie commented 6 years ago

I just upgraded an old Angular 4.x project to Angular 6.x and ran into the same problem. This project looks like it has been abandoned. There hasn't been a commit since Jan 24th, 2017.

I got it to run by patching the node_modules/datepicker.component.ts file and changing the animation references to @angular/animations.

import {
    Component, ElementRef, EventEmitter, Input, OnChanges,
    OnInit, Output, Renderer, SimpleChange
} from '@angular/core';

import {
    animate, keyframes, state, style, transition, trigger
} from '@angular/animations';

I then created a patch file and apply the patch postinstall

vardansafaryan0407 commented 6 years ago

@humblepie actuall I have already solved the issue updating jquery and adding @types/jquery of the same version`

this is my package.json "dependencies": { "@angular/animations": "6.1.0", "@angular/common": "6.1.0", "@angular/compiler": "6.1.0", "@angular/compiler-cli": "6.1.0", "@angular/core": "6.1.0", "@angular/forms": "6.1.0", "@angular/http": "6.1.0", "@angular/platform-browser": "6.1.0", "@angular/platform-browser-dynamic": "6.1.0", "@angular/platform-server": "6.1.0", "@angular/router": "6.1.0", "angular2-material-datepicker": "^0.5.0", "jquery": "3.3.5", ......... }, "devDependencies": { "@angular-devkit/build-angular": "~0.7.0", "@angular/cli": "^6.1.1", "@types/jquery": "^3.3.5", ....... }, this works for me

schnucks-rrphillips commented 5 years ago

It's a mystery to me how updating @types/jquery and jquery would have any bearing on the fact that this module is incompatible with Angular 6. The issue with angular2-material-datepicker is it imports animate from @angular/core instead of the new location @angular/animations. Also, there is no version 3.3.5 of jquery so npm install reports: No matching version found for jquery@^3.3.5. jquery 3.3.1 is the latest. But I tried this suggestion anyway with the latest versions of both and unsurprisingly I got the same error: /node_modules/@angular/core/core"' has no exported member 'animate'. It would be lovely if this project got updated.