title: Algolia instantsearch angular 5, TypeError: instantsearch is not a function at component
body: <p>I'm trying to implement algolia instant search into my Angular 5 application, and are using this tutorial: <a href="https://angularfirebase.com/lessons/angular-full-text-search-with-algolia-frontend-part-1/" rel="nofollow noreferrer">Angular Full Text Search With Algolia Frontend</a> And i have installed instantsearch.js</p>
  
  <p>I get a error: <strong><code>ERROR TypeError: instantsearch is not a function at SearchUiComponent.ngOnInit</code></strong></p>
  
  <p>I've tried to add the following to import statement:</p>
  
  <pre><code>import * as instantsearch from 'instantsearch.js';
  declare var instantsearch: any;
  </code></pre>
  
  <p>And</p>
  
  <pre><code>import * as instantsearch from 'instantsearch.js/es'
  </code></pre>
  
  <p>SearchUi.component:</p>
  
  <pre><code>import { Component, OnInit } from '@angular/core';
  import { environment } from '../../environments/environment';
  import * as instantsearch from 'instantsearch.js'
  
  export class SearchUiComponent implements OnInit {
  
  search: any;
  
  constructor() { }
  
  ngOnInit() {
  const options = environment.algolia;
  
  this.search = instantsearch(options);
  
  // search box widget
  this.search.addWidget(
    instantsearch.widgets.searchBox({
      container: '#search-box',
      autofocus: false,
      placeholder: 'Search for actors',
      poweredBy: true
    })
  );
  this.search.start();
  </code></pre>
  
  <p>SearchUi.html</p>
  
  <pre><code>&lt;div id="search-box"&gt;
   &lt;!-- SearchBox widget will appear here --&gt;
  &lt;/div&gt;
  &lt;div id="hits"&gt;
   &lt;!-- Hits widget will appear here --&gt;
  &lt;/div&gt;
  </code></pre>