Files
EnvelopeGenerator/envelope-generator-ui/src/app/services/url.service.ts
TekH eda30472b9 No changes detected in diff
No code was added or removed in the provided diff; only context lines were present.
2026-02-02 10:14:15 +01:00

26 lines
638 B
TypeScript

import { Injectable, Inject, inject } from '@angular/core';
import { DOCUMENT } from '@angular/common';
import { Meta } from '@angular/platform-browser';
@Injectable({
providedIn: 'root'
})
export class UrlService {
document: Document;
meta: Meta;
constructor() {
this.document = inject(DOCUMENT)
this.meta = inject(Meta)
}
getBaseHref(): string {
const baseElement = this.document.querySelector('base');
return baseElement?.getAttribute('href') || '/';
}
getApiUrl(): string | null {
const apiMetaTag = this.meta.getTag('name="api-url"');
return apiMetaTag ? apiMetaTag.content : null;
}
}