import { Injectable } from '@angular/core';
@Injectable({
providedIn: 'root'
})
export class MailtoService {
private readonly _email = 'hellodata@trendency.hu';
private readonly _subject = 'Ajánlatot kérek';
public openMailto(body?: string): void {
const mailtoUrl = `mailto:${this._email}?subject=${encodeURIComponent(this._subject)}${
body ? `&body=${encodeURIComponent(body)}` : ''
}`;
window.location.href = mailtoUrl;
}
}
private readonly _mailto = inject(MailtoService);
public mailtoWithSubject(): void {
this._mailto.openMailto();
}
<app-button [label]="'HEADER.LABEL' | transloco" (clickEvent)="mailtoWithSubject()" />