gpt4 book ai didi

Angular TypeError : _angular_core__WEBPACK_IMPORTED_MODULE_1__. ɵɵdefineInjectable 不是函数

转载 作者:行者123 更新时间:2023-12-04 04:07:41 25 4
gpt4 key购买 nike

我正在运行我的应用程序 LiveCicle当我导航到 map 路线时,我收到此错误:

ERROR Error: Uncaught (in promise): TypeError: _angular_core__WEBPACK_IMPORTED_MODULE_1__.ɵɵdefineInjectable is not a function
TypeError: _angular_core__WEBPACK_IMPORTED_MODULE_1__.ɵɵdefineInjectable is not a function
at tm.service.ts:9

这很奇怪,因为我将 tm 服务定义为路由模块中的提供者。
@NgModule({
providers: [
{
provide:
HTTP_INTERCEPTORS
,

useClass: AuthInterceptor,
multi: true
},
TicketMasterService
],
})
const routes: Routes = [
{path: 'map', loadChildren: () => import('./event-map-page/event-map-page.module').then(m => m.EventMapPageModule)},

{path: '**', redirectTo: '', pathMatch: 'full'},

];

@NgModule({
imports: [RouterModule.forRoot(routes)],
exports: [RouterModule]
})
export class AppRoutingModule { }

我只在生产中得到这个错误。当我在本地运行时,一切正常。
import { Injectable, OnInit } from '@angular/core';
import { HttpClient, HttpParams, HttpHeaders } from '@angular/common/http';
import { environment } from '../../environments/environment';
import { DataService } from '../../services/dataService/data.service';
import { TmEvent } from '../../models/tmEvent/tm-event.model';
@Injectable()
export class TicketMasterService {
noAuthHeader = { headers: new HttpHeaders({ 'NoAuth': 'True'})};
private readonly TM_EVENTS = 'TM_EVENTS';
tmEvents: any = [];
constructor(private http: HttpClient, private data: DataService) {
}

fetchTmData() {
this.http.get(environment.apiBaseUrl + '/ticketmaster-events', this.noAuthHeader).subscribe(res => {
this.getTheFields(res);
});
}
}

最佳答案

我尝试了类似的问题
转至 ./node_modules/ng-inline-svg/lib_esmodule/svg-cache.service.js并搜索 ɵɵ并删除它
或点击错误并搜索ɵɵ并删除它
我希望这对任何人都有用

关于Angular TypeError : _angular_core__WEBPACK_IMPORTED_MODULE_1__. ɵɵdefineInjectable 不是函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62256725/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com