While testing my code locally in production, the functions I've written are returning the expected values when two parameters are passed in.
However, after running ng build --prod --aot
, the variable name within the functions changes from name
to t
. This results in one function returning a result while the other function returns nothing.
I have attempted to rename the function parameters both in the Angular template and inside the component.ts file.
Below are the original functions I wrote:
submitContact(name,email,subject,message){
const callable = this.fun.httpsCallable('contactEmail')
callable({
name:name,
email:email,
subject:subject,
message:message
}).subscribe()
console.log(name,email,subject,message)
alert("Thanks for your message")
}
submitForm(fullname,emailaddress){
const callable = this.fun.httpsCallable('genericEmail')
callable({
name:fullname,
email:emailaddress
}).subscribe()
alert("Thanks for signing up!")
console.log(fullname,emailaddress)
}
This is the code that is produced after running ng build --prod --aot
:
t.prototype.submitForm = function(t, e) {
this.fun.httpsCallable("genericEmail")({
name: t,
email: e
}).subscribe(),
alert("Thanks for signing up!"),
console.log(t, e)
}
t.prototype.submitContact = function(t, e, n, r) {
this.fun.httpsCallable("contactEmail")({
name: t,
email: e,
subject: n,
message: r
}).subscribe(),
console.log(t, e, n, r),
alert("Thanks for your message")
}
Although I would expect both functions to display results in the console, only submitcontact
does.
Furthermore, when submitcontact
is executed, I receive the following error message:
Uncaught (in promise) DOMException: Failed to execute 'postMessage' on 'Window': An object could not be cloned.
at Object.t.messageJumpContext (chrome-extension://elgalmkoelokbchhkhacckoklkejnhcd/build/content-script.js:24:9921)
at chrome-extension://elgalmkoelokbchhkhacckoklkejnhcd/build/content-script.js:24:8583
Despite the error message, the result still displays. I am unsure of what needs to be adjusted to get both functions to produce results consistently.