Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ANGULAR Error : core_1.InjectionToken is not a constructor

When i start my Angular 2 App the App is always in loading stage.

In the chrome dev console i can see the following:

 Error: (SystemJS) core_1.InjectionToken is not a constructor
    TypeError: core_1.InjectionToken is not a constructor
        at Object.eval (http://localhost:3000/node_modules/ng-pick-datetime/lib/translations.js:9:24)

My Setup is :

@angular/cli: 1.0.0
node: 7.8.0
os: linux x64
@angular/common: 2.4.10
@angular/compiler: 2.4.10
@angular/core: 2.4.10
@angular/forms: 2.4.10
@angular/http: 2.4.10
@angular/platform-browser: 2.4.10
@angular/platform-browser-dynamic: 2.4.10
@angular/router: 3.0.2
@angular/upgrade: 2.4.10
@angular/cli: 1.0.0
like image 769
Abhishek Ranjan Avatar asked Oct 20 '25 03:10

Abhishek Ranjan


1 Answers

Angular 4 introduce InjectionToken to replace OpaqueToken, if you using Angular 2, please using OpaqueToken instead. But, I'd recommend update your app to Angular 4.

you can update your project by following this tutorial: https://github.com/angular/angular-cli/wiki/stories-1.0-update

like image 81
Tiep Phan Avatar answered Oct 22 '25 17:10

Tiep Phan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!