Within my app.resolver.service.ts file, I have an Abstract class. During development, everything works fine, but I encounter an error in the PROD build.
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Resolve, ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router';
// Annotation section
@Injectable()
abstract class RequestResolver implements Resolve<any> {
abstract dataUrl: string;
constructor( public http: HttpClient ){
this.http = http;
}
abstract resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot)
}
export class ProjectResolver extends RequestResolver {
dataUrl: string = "https://api.citysdk.waag.org/layers/parking.garage/objects?per_page=50";
public resolve() {
return this.http.get(this.dataUrl);
}
}
https://i.sstatic.net/wkVG8.png
I came across a functional example that does not utilize an abstract class.
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Resolve, ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router';
// Annotation section
@Injectable()
export class ProjectResolver {
private dataUrl: string = "https://api.citysdk.waag.org/layers/parking.garage/objects?per_page=50";
constructor( public http: HttpClient ){
this.http = http;
}
public resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) {
return this.http.get(this.dataUrl);
}
}