angular2-jwt: Crash in Angular2 RC6
Angular2 RC6 removes a lot of deprecated API.
Angular2-JWT uses the provide()
method from @angular/core which has been removed.
Two approaches can be taken to fix this:
- Frist is to convert the code to export an NgModule
- Second is to convert the code to use the new Provider structure
/cc @chenkie
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 18 (7 by maintainers)
So there are already three PRs fixing rc.6. Are you guys trying to make @chenkie’s phone vibrate enough so he wakes up or something? Should I send another PR as well? 😉
Maybe not a direct answer or related to the question but might be worth noting: I imported AuthHttp from
angular2-jwt/angular2-jwt
in my main app module to register as a provider but imported AuthHttp fromangular2-jwt
in myauth.service.ts
. This caused a “no provider for AuthHttp” error. After hours of debugging I fixed this by importing any AuthHttp classes from the sameangular2-jwt
file. This was caused by WebStorm as I took over this project from another developer.@ShadowManu #145 has some logic which can lead to false positives during the isTokenExpired check. In my opinion I think this issue should still be open until it’s resolved as the fix that was merged is inadequate.
I unpublished the
npm
package since the crash was fixed in #145 and published in version0.1.21
. Looks like you’re getting my github branch, but that’s also no longer needed. Update and you’ll be good.PS: the main topic of this thread is fixed, issue should be closed.
@ShadowManu from what I know Angular themselves have moved to Typescript 2 and it is now in <strike>stable</strike> RC soon to be released as stable. I don’t think it’s strictly required but recommended.
Also their offline compiler tool uses Typescript 2.
I would personally recommend it due to the upgrades in type checking and configuration.