function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
kallam salesforce1kallam salesforce1 

I am not getting any results, what is the error in my program?

Here i am using @wire as property and trying to iterate values. Could you please tell what is the error in below program?

public with sharing class lDS_GetContacts_Wire2 {
    @AuraEnabled(cacheable=true)
    public static list<Contact> findContacts(string searchtext){
          string key = '%'+searchtext+'%';
          return [Select id,Name,Phone,Email from Contact where FirstName LIKE:key];
    }
}

HTML FILE

<template>
    <lightning-card title="Search Contact WIRE">
        <lightning-input label="Enter the Search Text" type="search" value={searchkey} onchange={handleOnchange}>
            <template if:true={contact.data}>
                <template for:each={contact.data} for:item="con">
                    <p key={con.id}>{con.Name}</p>
                </template>
            </template>
            <template if:true={contact.error}>
                Sorry we can't display your record due to {contact.error}. Please Try Later.
            </template>
        </lightning-input>
    </lightning-card>
</template>

Js File >>>>>>>
import { LightningElement,track,wire} from 'lwc';
import findcontacts from '@salesforce/apex/lDS_GetContacts_Wire2.findContacts';
export default class LDS_SearchContact_Wire extends LightningElement {
    @track searchkey;
    @wire (findcontacts,{searchtext :'$searchkey'}) contact;
    handleOnchange(event){
        this.searchkey = event.target.value;
    }
}