Javascript 从infowindow NgMap调用一个方法

Javascript 从infowindow NgMap调用一个方法,javascript,angularjs,infowindow,ng-map,Javascript,Angularjs,Infowindow,Ng Map,我有一个信息窗口。我正在尝试调用基于复选框的函数。这是我的密码 $scope.showDetails = function(e, pothole) { console.log(pothole); var infowindow = new google.maps.InfoWindow(); var center = new google.maps.LatLng(pothole.lat,pothole.lng);

我有一个信息窗口。我正在尝试调用基于复选框的函数。这是我的密码

 $scope.showDetails = function(e, pothole) {
            console.log(pothole);
            var infowindow = new google.maps.InfoWindow();
            var center = new google.maps.LatLng(pothole.lat,pothole.lng);

            infowindow.setContent(
            '<label class="switch">'+
                '<input ng-model="mycheckbox" ng-change = "remove(pothole.lat,pothole.lng,mycheckbox)" type="checkbox" checked />'+
            '<span class="slider round"></span>'+
                '</label>');

            infowindow.setPosition(center);
            infowindow.open($scope.map);
        };

有人能帮我吗?感谢做出
ng更改
事件触发器,需要使用编译信息窗口内容

替换

infowindow.setContent(
            '<label class="switch">'+
                '<input ng-model="mycheckbox" ng-change = "remove(pothole.lat,pothole.lng,mycheckbox)" type="checkbox" checked />'+
            '<span class="slider round"></span>'+
                '</label>');

您是否尝试删除html字符串中的空格
ng change=“remove
ng change=“remove
infowindow.setContent(
            '<label class="switch">'+
                '<input ng-model="mycheckbox" ng-change = "remove(pothole.lat,pothole.lng,mycheckbox)" type="checkbox" checked />'+
            '<span class="slider round"></span>'+
                '</label>');
var content = '<label class="switch">'+
                    '<input ng-model="mycheckbox" ng-change = "remove(pothole.lat,pothole.lng,mycheckbox)" type="checkbox" checked />'+
                '<span class="slider round"></span>'+
                    '</label>';
var compiledContent = $compile(content)($scope);
infowindow.setContent(compiledContent[0]);