Ng-click in infowindow in google map wont work


I am successfully implement google map in ionic ,but ng-click in infowindow not working.

marker.btn='<button class="button button-positive" ng-click="goToPage()">Test</button>';
    google.maps.event.addListener(marker, 'click', function(){
    		            infoWindow.setContent('<h2>' + marker.title + '</h2>' + marker.content+marker.btn);
    		  $, marker);


Default google map API it’s outside “Angular/ionic” workflow. Really I dont know a better way to do this, but im sure there is a better way.

You can use Angular Google Maps or call the $scope funcion directly from outside angular $scope.

marker.btn='<button class="button button-positive" ng-click="angular.element(\'#map\').scope().goToPage()">Test</button>';
google.maps.event.addListener(marker, 'click', function() {
    infoWindow.setContent('<h2>' + marker.title + '</h2>' + marker.content+marker.btn);$, marker);

Yes I know, this solution killed my mind, but really is the only thing I could imagine


Thats not working in my case