I am trying to configure a function in my Angular 2 application that will send an email using the user's default email client with some pre-populated information:
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 ran into a problem when I get an error:
It is not possible to assign a "location" because it is persistent or a read-only property. webpack: Failed to compile.
The examples I've seen so far describe this with "window.location", so how can I solve this problem?
source share