One of my classes is called ClientBase:
export class ClientBase {
constructor(private uri: string, private httpClient: HttpClient) { }
// Contains Various Methods
}
I have multiple subclasses that are derived from the ClientBase
For instance:
@Injectable()
export class GizmoService extends ClientBase {
constructor(private http: HttpClient)
{
super(environment.gizmoUri, http);
}
};
In the GizmoService class, there is a specific need to pass the Uri in a particular scenario..
The ideal approach would be something like this:
@Injectable()
export class GizmoService extends ClientBase {
constructor(private http: HttpClient, uri?: string)
{
if (!uri) uri = environment.gizmoUri;
super(uri, http);
}
};
However, an error message appears indicating that super must be the first call in the constructor.
Is there a way to work around this issue without making extensive modifications to the current code base? (i.e. Without altering every function call to include 2 parameters)