I am working with four components and I have a need to pass data from a parent component to a child component. The structure defined within the map.html
template is as follows:
<map-builder [width]="width">
<layer [name]="'markerLayer'">
<marker [lat]="8.5" [lng]="55.5"></marker>
<marker [lat]="54" [lng]="8.5"></marker>
</layer>
<layer [name]="'heatmapLayer'">
<heatmap></heatmap>
</layer>
</map-builder>
Within the LayerComponent
, I have initialized variables named layer
and source
. In the ngOnInit()
function, I have set values to both of these variables. However, I am facing challenges in accessing these values within the nested components (Marker
and Heatmap
). I attempted to inject the LayerComponent
in the constructor()
, but unfortunately, I am unable to access its variables.
Your guidance on this matter would be greatly appreciated!