我正在尝试使用"ng-http-loader"为angular api调用实现微调器。代码运行良好,但在构建我的应用程序"Yarn build"时失败,出现以下错误:
指令AbstractLoaderDirective中存在错误E://node_modules/ng http-loader/ng-http-loader.dts中的指令没有选择器,请添加它!无法在E://node_modules/ng http-loader/ng-http-loader.dts中确定类AbstractLoaderDirective的模块!将AbstractLoaderDirective添加到NgModule以修复它。
有人遇到这个错误吗?
实施遵循中提供的步骤:https://www.npmjs.com/package/ng-http-loader
production.module.ts:
import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { RouterModule } from '@angular/router';
import { OnesortParcelsSharedModule } from 'app/shared/shared.module';
import { NgHttpLoaderModule } from 'ng-http-loader';
import { PRODUCTION_ROUTE, ProductionComponent } from './';
@NgModule({
imports: [OnesortParcelsSharedModule, NgHttpLoaderModule.forRoot(), RouterModule.forRoot([PRODUCTION_ROUTE], { useHash: true })],
declarations: [ProductionComponent],
entryComponents: [],
providers: [],
schemas: [CUSTOM_ELEMENTS_SCHEMA]
})
export class OnesortParcelsAppProductionModule {}
production.component.html:
<ng-http-loader [filteredMethods]="['GET', 'POST']"></ng-http-loader>
版本:Angular CLI:8.3.1节点:13.11.0操作系统:win32 x64角度:8.2.4
版本:"依赖项":{"@angular/common":"8.2.4","@angular/compiler":"8.2.4","@棱角/核心":"8.2.4","@角度/形式":"8.2.4","@angular/platform browser":"8.2.4","@angular/platform browser dynamic":"8.2.4","@angular/router":"8.2.4","@fortawesome/angular font真棒":"0.5.0","@fortawesome/fontwo敬畏的svg核心":"1.2.22","@fortawesome/free实心svg图标":"5.10.2","@ng bootstrap/ng bootstrap":"^5.2.1","@ngx-translate/core":"11.0.1","@ngx-translate/http-loader":"4.0.0","引导程序":"4.3.1","core-js":"3.2.1","力矩":"2.24.0","ng http加载程序":"^7.0.0",
nghttp加载程序7.0.0版本有中断更改,请尝试安装"ng-http-loader": "^6.0.1"
,错误应该会消失。