I am trying to get the amp-autocomplete to go directly to a url that it gets from the json list when clicked on. The href is included in the result but when clicking on the result it just adds it to the input box and doesn't direct.
I tried on="tap:AMP.navigateTo(url='{{url}}')" which didn't seem to do anything. Not sure if it is possible to do this with amp?
<form class="sample-form" method="post" target="_top" action-xhr="https://amp.dev/documentation/examples/api/echo">
<label>
<span>Search for</span>
<amp-autocomplete filter="token-prefix" filter-value="h1" min-characters="2">
<input type="search" name="h1">
<script type="application/json">
{
"items":[
{
"h1":"page1",
"url":"page-1-url"
},{
"h1":"page2",
"url":"page-2-url"
},
{
"h1":"page3",
"url":"page-3-url"
}
]
}
</script>
<template type="amp-mustache" id="amp-template-custom">
<div class="slug-item" data-value="{{h1}}">
<a href="{{url}}" on="tap:AMP.navigateTo(url='{{url}}')">{{h1}}</a>
</div>
</template>
</amp-autocomplete>
</label>
</form>