I am running my app LiveCicle and when I navigate to the map route I get this error:
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
This is weird because I am defining tm service as a provider in the route's module.
@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 { }
I only get this error in production. everything works perfectly when I run locally.
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);
});
}
}