The Lightning navigation service allows you to navigate in Lightning
Experience, Lightning Communities and the Salesforce app. To generate a
URL or navigate to a page reference, use the lightning-navigation
service wire adapters and functions.
A
PageReference
is a JavaScript object that describes the page type, its attributes, and the state of the page.Step 1) Import lightning/navigation
import { NavigationMixin } from 'lightning/navigation';
Step 2) Apply the NavigationMixin function to your component’s base class.
export default class MyCustomElement extends NavigationMixin(LightningElement) {
}
Step 3) Call the navigation service’s [NavigationMixin.Navigate] function to
dispatch the navigation request and open the New Course Delivery modal
dialog.
onAddNewDelivery() {
this[NavigationMixin.Navigate]({
type: 'standard__objectPage',
attributes: {
objectApiName: 'Student__c',
actionName: 'new'
}
});
}
What is a Mixin?
A mixin lets us add functionality to a class without extending it.
Useful when a class already extends a parent class, because a class can
only extend a single parent.
Check this recording after 1st hours.
No comments:
Post a Comment