cipchk / ngx-countdown

Simple, easy and performance countdown for angular
https://cipchk.github.io/ngx-countdown/
MIT License
192 stars 57 forks source link

Update to angular 7 #26

Closed hassan-haghi closed 5 years ago

hassan-haghi commented 5 years ago

Hello Please update to angular 7

thank you

cipchk commented 5 years ago

The laster version can be used in angular7, including prod env.

ravetroll commented 5 years ago

I just updated to angular 7.

Whole app is working fine except for this component with these compile warnings (not errors):

`./node_modules/ngx-countdown/node_modules/@angular/core/fesm5/core.js 4982:15-36 Critical dependency: the request of a dependency is an expression

./node_modules/ngx-countdown/node_modules/@angular/core/fesm5/core.js 4994:15-102 Critical dependency: the request of a dependency is an expression`

However when it runs i get a runtime error

ERROR Error: StaticInjectorError(AppModule)[CountdownComponent -> ElementRef]: StaticInjectorError(Platform: core)[CountdownComponent -> ElementRef]: NullInjectorError: No provider for ElementRef! at NullInjector.push../node_modules/@angular/core/fesm5/core.js.NullInjector.get (core.js:717) at resolveToken (core.js:954) at tryResolveToken (core.js:898) at StaticInjector.push../node_modules/@angular/core/fesm5/core.js.StaticInjector.get (core.js:795) at resolveToken (core.js:954) at tryResolveToken (core.js:898) at StaticInjector.push../node_modules/@angular/core/fesm5/core.js.StaticInjector.get (core.js:795) at resolveNgModuleDep (core.js:17739) at NgModuleRef_.push../node_modules/@angular/core/fesm5/core.js.NgModuleRef_.get (core.js:18428) at resolveDep (core.js:18799)

Any ideas. I am running it in ng serve mode

hassan-haghi commented 5 years ago

I just updated to angular 7.

Whole app is working fine except for this component with these compile warnings (not errors):

`./node_modules/ngx-countdown/node_modules/@angular/core/fesm5/core.js 4982:15-36 Critical dependency: the request of a dependency is an expression

./node_modules/ngx-countdown/node_modules/@angular/core/fesm5/core.js 4994:15-102 Critical dependency: the request of a dependency is an expression`

However when it runs i get a runtime error

ERROR Error: StaticInjectorError(AppModule)[CountdownComponent -> ElementRef]: StaticInjectorError(Platform: core)[CountdownComponent -> ElementRef]: NullInjectorError: No provider for ElementRef! at NullInjector.push../node_modules/@angular/core/fesm5/core.js.NullInjector.get (core.js:717) at resolveToken (core.js:954) at tryResolveToken (core.js:898) at StaticInjector.push../node_modules/@angular/core/fesm5/core.js.StaticInjector.get (core.js:795) at resolveToken (core.js:954) at tryResolveToken (core.js:898) at StaticInjector.push../node_modules/@angular/core/fesm5/core.js.StaticInjector.get (core.js:795) at resolveNgModuleDep (core.js:17739) at NgModuleRef_.push../node_modules/@angular/core/fesm5/core.js.NgModuleRef_.get (core.js:18428) at resolveDep (core.js:18799)

Any ideas. I am running it in ng serve mode

When I upgraded to angular 7, I also gave this error.

ravetroll commented 5 years ago

Its failing to compile with this error:

ERROR in ../node_modules/@angular/core/src/render3/ng_dev_mode.d.ts(9,11): error TS2451: Cannot redeclare block-scoped variable 'ngDevMode'. ../node_modules/ngx-countdown/node_modules/@angular/core/src/render3/ng_dev_mode.d.ts(9,11): error TS2451: Cannot redeclare block-scoped variable 'ngDevMode'.

I think it is because it refers to Angular 6.1 in its own package.json, so possibly we have two version of angular running?

cipchk commented 5 years ago

https://unpkg.com/ngx-countdown@3.1.0/package.json

ravetroll commented 5 years ago

I see that package.json @cipchk . What can be done to fix this problem? It looks like this ngDevMode is created in 2 places, in the app node_modules and then in the node_modules of ngx-countdown. I am not sure why it would be a problem now when it was running fine with my app on Angular 6.1.x

ravetroll commented 5 years ago

I tried an ng build --prod and got ERROR in ngx-countdown\countdown.ts(7,2): Error during template compile of 'CountdownModule' Function calls are not supported in decorators but 'ɵmakeDecorator' was called in 'NgModule' 'NgModule' calls 'ɵmakeDecorator'. ../node_modules/@angular/core/src/render3/ng_dev_mode.d.ts(9,11): error TS2451: Cannot redeclare block-scoped variable 'ngDevMode'. ../node_modules/ngx-countdown/node_modules/@angular/core/src/render3/ng_dev_mode.d.ts(9,11): error TS2451: Cannot redeclare block-scoped variable 'ngDevMode'.

I think we need to re-open this issue.

ravetroll commented 5 years ago

Ok, I resolved it by deleting the node_modules folder out of the ngx-countdown folder. That meant there were no longer two copies of the file.