I am trying to set up a function in my Angular 2 app that will send an email using the user's default email client with some pre-populated info:
sendEmail() {
this.title = document.title;
this.title = this.title.replace("&", "-");
window.location = "mailto:?body=" + this.title + " - " + window.location + "&subject=I thought this link might interest you.";
}
But I'm running into an issue where I'm getting an error:
Cannot assign to 'location' because it is a constant or a read-only property. webpack: Failed to compile.
The examples I've seen so far all describe doing it thie way, with "window.location", so how can I resolve this issue?