Answer the question
In order to leave comments, you need to log in
Why don't callback functions trigger ngClass firings in angular 5?
Here is the function to plot the route in google maps:
calculateAndDisplayRoute(callback = null) {
var waypts = [];
this.directionsService.route({
origin: "Аэропорт, Республика Башкортостан, Россия",
destination: $('#address_to').val(),
waypoints: waypts,
optimizeWaypoints: true,
travelMode: 'DRIVING'
}, (response, status) => {
if (status === 'OK') {
this.setLengthByResponse(response);
this.marker.setMap(null);
this.directionsDisplay.setDirections(response);
callback ? callback(true) : null;
} else {
callback ? callback(false) : null;
}
});
this.calculateAndDisplayRoute((result) => {
console.log(result);
if (result) {
$("#terminal-steps").steps("next");
}
else {
this.errors['address'] = ['Уточните адрес или выберите адрес из списка'];
}
});
hasError(field)
{
let classList = {
'has-error' : this.errors[field] != undefined
};
return classList;
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question