#StackBounty: #angular #algolia #instantsearch.js How to get specific data from algolia in angular

Bounty: 50

I’m using algolia in angular.
I’m trying to get only a specific record from algolia.
I have a product_id and want record of that product_id
Here is what I have done so far –
.html file

    <ais-instantsearch [conproducts]>
        <ais-configure [searchParameters]="{ hitsPerPage: 1 }"></ais-configure>
        <ais-hits>
           <ng-template let-hits="hits">
           <div class="row">
                <div class="col-lg-2 col-md-3 col-sm-4 col-6"*ngFor="let hit of hits">
                    {{hit.name}}
                 </div>
           </div>
           </ng-template>
         </ais-hits>
    </ais-instantsearch>

.ts file

    const searchClient = algoliasearch(
      environment.algolia_application_id,
      environment.algolia_search_api_key
    );
    
    export class ProductsComponent implements OnInit {
      productsConfig = {
          indexName: 'products',
          searchClient
      };
    }

How to get specific data by id in the algolia?
Any help would be appreciated,
Thanks


Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.