I am attempting to navigate when a button-click occurs in lightning. Nothing happens when I click the button. Any thoughts on how to make this work? Code sample included:
import { LightningElement, track } from 'lwc';
import { NavigationMixin } from 'lightning/navigation';
export default class CreateNewTSSCaseButton extends
NavigationMixin(LightningElement) {
connectedCallback()
{
// Opening
console.log("connectedCallback.Start");
// Navigate to Account Page
this.accountHomePageRef = {
type: "standard__objectPage",
attributes: {
"objectApiName": "Account",
"actionName": "home"
}
};
this[NavigationMixin.GenerateUrl](this.accountHomePageRef)
.then(url => this.url = url);
// Closing
console.log("connectedCallback.Finish");
}
AddTSSCase_Click() {
// Opening
console.log("AddTSSCase_Click.Start");
// Perform navitation
console.log(this.accountHomePageRef);
this[NavigationMixin.GenerateUrl](this.accountHomePageRef)
.then(url => this.url = url);
// Closing
console.log("AddTSSCase_Click.Finish");
}
}
BTW, I am getting all Console.log messages in the Console window, so AddTSSCase_Click is firing.