I have an issue and can't remember how to get around it. I am subscribing to a callback from a third party directive but not being called back with the correct scope. And by that I mean that when it hits my controller this
is actually some other scope I cant quite figure out so it cannot access any member variables. How do I get back to my controller scope?
<ui-gmap-layer type="HeatmapLayer" onCreated="$ctrl.heatLayerCallback"></ui-gmap-layer>
Component Controller:
heatLayerCallback(heatLayer: google.maps.visualization.HeatmapLayer) {
this.heatMapLayer = heatLayer;
// 'this' here is not my controller
}
If I change the call back to
<ui-gmap-layer onCreated="$ctrl.heatLayerCallback(layer)"></ui-gmap-layer>
Then my callback executes on the right scope (i.e. my controller) but the parameter layer
is lost ;/
Notes
I am using Typescript, Angular 1.6 and Angular Components