The method in code section_1
is in the parent component and when I display the contents of the received event in measurementCoordinates
in the browser's console I received:
onMeasurementCoordinatesReceived:-> [object Object]
But when I attempt to access any property of the received event I receive undefined
.
Please let me know how to access and read a property on an interface object
code:
onMeasurementCoordinatesReceived(measurementCoordinates: ICoordinates) {
console.log("onMeasurementCoordinatesReceived:-> " + measurementCoordinates);
}
interface in the chils component
export interface ICoordinates {
originLng: number;
originLat: number;
destinationLng: number;
destinationLat: number;
}
first, you can console.log a string + object with a "," instead of "+" like:
console.log("string", object)
otherwise, js will use the default toString "[object Object]"
you can access to a property like anyother object, just like:
objectName.propertyName