What is it called when one component is inside another? like in
<agm-map [latitude]="lat" [longitude]="lng">
  <agm-marker [latitude]="lat" [longitude]="lng"></agm-marker>
</agm-map>
And how it works?
You have to use ng-content
<ng-content></ng-content>
<ng-content select="agm-marker"></ng-content>
you have to declare two components as:
agm-map.component.ts
@Component({
    selector: 'agm-map',
    template: '<ng-content></ng-content>
            <ng-content select="agm-marker"></ng-content>'
})
export class AgmMapComponent {
  ...
}
agm-marker.component.ts
@Component({
    selector: 'agm-marker',
    template: '<div>Marker</div>'
})
export class AgmMarkerComponent {
  ...
}
But I guess you want to pass latitude/longitude to your child component for that you can read the documentation related to how to pass data from parent to child component here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With