Created
March 18, 2019 22:34
-
-
Save ketan-benegal/1db3e90c70651b10a895d59cde9ad9af to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*eslint no-console: ["error", { allow: ["warn", "error"] }] */ | |
import { LightningElement, track, wire, api } from 'lwc'; | |
import findContacts from '@salesforce/apex/ContactController.getContacts'; | |
/** The delay used when debouncing event handlers before invoking Apex. */ | |
const DELAY = 300; | |
export default class ApexWireMethodWithParams extends LightningElement { | |
@track searchKey = ''; | |
@api recordId; | |
@wire(findContacts, { searchKey: '$searchKey' }) | |
contacts; | |
//connectedCallback function is similar to init method in Lightning Components. | |
connectedCallback(){ | |
this.searchKey = this.recordId; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment