【发布时间】:2019-04-17 17:50:01
【问题描述】:
我已经在 AppModule 中导入了 HttpClientModule。
import { HttpClientModule } from '@angular/common/http';
export const AppRoutes: Routes = [
{ path: '', redirectTo: 'dashboard', pathMatch: 'full' },
{
path: 'account',
loadChildren: './auth/auth.module#AuthModule'
},
{
path: 'dashboard',
loadChildren: './content/content.module#ContentModule'
}
];
一旦我启动站点,它将重定向到我添加了 http 拦截器的仪表板模块(延迟加载模块)。
import { HTTP_INTERCEPTORS } from '@angular/common/http';
import { HttpInterceptorService } from '../services/http-interceptor.service';
@NgModule({
providers : [
{ provide: HTTP_INTERCEPTORS, useClass: HttpInterceptorService, multi: true }
]
})
但它不起作用。谁能帮帮我?
【问题讨论】:
-
发布 appmodule ts
标签: angular http httpclient interceptor angular-http-interceptors