I am facing an issue while trying to integrate the places.js library into my Angular 7 project. I have added the necessary script in my 'index.html' file as follows:
<script src="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="eb9b878a888e98c58198abdac5daddc5df">[email protected]</a>"></script>
<script>
var placesAutocomplete = places({
appId: 'myAppId',
apiKey: 'myApiKey',
container: document.querySelector('#addressInput')
});
</script>
However, it only works when I have the following input field in my 'index.html':
<input type="search" id="address-input" placeholder="Where are we going?" />
I tried moving this input field to a component but encountered an error:
<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="087864696b6d7b26627b483926393e263c">[email protected]</a>:1 Uncaught Error: Algolia Places: 'container' must point to an <input> element.
Is there a way to make this script work with a component? The documentation does not mention anything about TypeScript. I also attempted to use npm install and import * from 'places.js', but the problem persists. Any help would be greatly appreciated.