Skip to content

Integrate HTTP_INTERCEPTORS of Angular as FullRequestInterceptors #182

@patrickbussmann

Description

@patrickbussmann

If you have HTTP Interceptors from Angular, https://angular.io/api/common/http/HttpInterceptor, then this will be ignored from this ngx-restangular.
So it would be nice if someone could integrate this.

src/app/app.module.ts
export function RestangularConfigFactory(RestangularProvider) {
  RestangularProvider.setBaseUrl(environment.url);
  RestangularProvider.addFullRequestInterceptor(AuthInterceptor); // <- Not working!
}

@NgModule({
  imports: [
    RestangularModule.forRoot(RestangularConfigFactory),
    HttpClientModule,
  ],
  providers: [
    { provide: HTTP_INTERCEPTORS, useClass: AuthInterceptor, multi: true },
    { provide: HTTP_INTERCEPTORS, useClass: ErrorInterceptor, multi: true }
  ],
  bootstrap: [AppComponent]
})
export class AppModule {}

Thanks in Advance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions