Skip to content

Instantly share code, notes, and snippets.

@ketan-benegal
Created March 18, 2019 22:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ketan-benegal/1db3e90c70651b10a895d59cde9ad9af to your computer and use it in GitHub Desktop.
Save ketan-benegal/1db3e90c70651b10a895d59cde9ad9af to your computer and use it in GitHub Desktop.
/*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