Как настроить подсказки SuggestView у полей?
Помогите настроить подсказки адресов по одному городу. Делала по примеру https://yandex.ru/dev/maps/jsbox/2.1/multiroute_taxi Вот код, работает как надо, но подсказки показывает по всей планете.
ymaps.ready(init);
function init() {
var myMap0 = new ymaps.Map('map0', {
center: [57.6299, 39.8737],
zoom: 11,
type: 'yandex#map',
controls: []
}, {
searchControlProvider: 'yandex#search'
}),
myRoute,
routePanelControl = new ymaps.control.RoutePanel({
options: {
showHeader: true,
title: 'Построение маршрута',
routePanelTypes: {
taxi: true
},
autofocus: false
}
});
routePanelControl.routePanel.state.set({
type: "taxi"
});
ymaps.geocode('Ярославль', {
//boundedBy: myMap0.getBounds(),
//strictBounds: true,
results: 3
}).then(function(res) {
var zoomControl = new ymaps.control.ZoomControl({
options: {
size: 'small',
float: 'none',
position: {
bottom: 145,
right: 10
}
}
});
// Отключаем scrollZoom
myMap0.behaviors.disable('scrollZoom');
myMap0.controls.add(routePanelControl).add(zoomControl);
routePanelControl.routePanel.getRouteAsync().then(function(route) {
route.model.setParams({
results: 1
}, true);
route.model.events.add('requestsuccess', function() {
var activeRoute = route.getActiveRoute();
if(activeRoute) {
var length = route.getActiveRoute().properties.get("distance"),
length_value = round(length.value / 1000, 2),
duration = route.getActiveRoute().properties.get("duration"),
durationInTraffic = route.getActiveRoute().properties.get("durationInTraffic"),
points = route.getWayPoints(),
lastPoint = points.getLength() - 1,
from = points.get(0).properties,
to = points.get(lastPoint).properties;
var x = document.getElementById("route0");
x.style.display = "block";
}
});
});
});
}
Нужно изменить SuggestView у дефолтного кода от Яндекс, и никак не привязать этот код к примеру яндекса
var address = new ymaps.SuggestView(
'from', {
provider: {
suggest: (function(request, options) {
return ymaps.suggest('город Ярославль' + ", " + request)
})
}}
)
Или сделать отдельные поля, но никак с картой их связать не получилось
<input type="text" id="from">
<input type="text" id="to">
Как прописать address в код?