Open crissty opened 6 years ago
Hi @crissty. Do you have errors in dev tools console?
Probably related to https://github.com/akveo/nebular/issues/631.
Same problem here, need to include on each lazy module providers with interceptor to get it working.
So what do you mean by latest release? is it master? or what? master is never latest unless you pull.
So far my interceptors are working. As a matter of fact i am going to start a new project now based on the latest master branche. So i will let you know if i run in any problems with regards to your question.
Show us your code so we can have a look at it.
Quote: "Same problem here, need to include on each lazy module providers with interceptor to get it working." <- as i said show us your code.
The reason i ask for code is because if you dont do DI properly your service will be instantiated as new and not for Root.
I hope you understand where i am going with this.
I've had this problem as well. I think it has something to do with the ng2-smart-table. Everytime I import the Ng2SmartTable module, my interceptor doesn't intercept and I have to specify it in the providers. Can you try and see if it is the same for you?
I have the same problem with the following code in app.module.ts
:
providers: [
{provide: APP_BASE_HREF, useValue: environment.baseHref},
{provide: HTTP_INTERCEPTORS, useClass: NbAuthJWTInterceptor, multi: true},
{provide: NB_AUTH_TOKEN_INTERCEPTOR_FILTER, useValue: (req) => filter(req)},
],
I am importing HttpClientModule
only once in app.module.ts
.
The HttpClient
sends empty body - no token.
Using Angular 7 "@nebular/auth": "^3.0.1",
This worked for me:
provide: NB_AUTH_TOKEN_INTERCEPTOR_FILTER, useValue: (req) => {
return false;
}
@stenterwan I use angular 7.2.0 and nebular 3.1.0, but when I import Ng2SmartTable that use ng2-completer, the interceptor failed, and that occurs because ng2-completer import HttpClientModule!!
In the github repository of ng2-completer someone opened an issue for the same problem. They deleted the HttpClientModule import in versión 3.0.0-beta.2
.
I change my package.json and it's works, me and my partner created an issue !!
I've had this problem as well. I think it has something to do with the ng2-smart-table. Everytime I import the Ng2SmartTable module, my interceptor doesn't intercept and I have to specify it in the providers. Can you try and see if it is the same for you?
An awesome find. I struggled for 2 days to make my Interceptor work. Finally, your tip did the trick. As stated by @IgnacioYanjari, I've updated ng2-completer to 3.0.0-beta.2. Interceptor works without any issues now.
Hi @nileshnagarwal I just wondering, updating ng2-completer to latest stable version, now is 3.0.2 will solve this problem? so I've mean, Is there no need then to import and add the interceptor into each module as a provider?
Hi @nileshnagarwal I just wondering, updating ng2-completer to latest stable version, now is 3.0.2 will solve this problem? so I've mean, Is there no need then to import and add the interceptor into each module as a provider?
Hi @BruneXX I've been using ng2-completer version 3.0.0-beta.2 and have only added the interceptor to the providers in app.module.ts. No need to import it in each module separately.
Hi @nileshnagarwal excellent, I can confirm that it works with ng2-completer v3.0.2 thanks for your quick reply! :)
Issue type
I'm submitting a ... (check one with "x")
Issue description
Current behavior: I have a custom interceptor of angular included in AppModule, when I update the ngx-admin, the interceptor is not working, it is not called in several routes or it is call more than once.
Expected behavior: The interceptor should be called in every call.
Steps to reproduce: Update ngx-admin to last release.
Related code:
Other information:
npm, node, OS, Browser
Angular, Nebular