ng-href = tel无法在谷歌地图infowindow工作?

时间:2015-09-15 13:25:26

标签: javascript android angularjs google-maps ionic

这里我想显示移动图标,当用户按下该图标时,它应该为该特定经销商打电话。我已经使用这条线进入infowindow但它没有工作我怎么能解决这个我是这个谷歌地图的新手

.controller('MapCtrl', [
        '$scope', '$http', '$location', '$window', '$filter', '$ionicLoading', '$compile','$timeout','$ionicPopup',
        function($scope, $http, $location, $window, $filter, $ionicLoading, $compile, $timeout,$ionicPopup) {
	$scope.favoriteStore = '';
    $scope.Storetype = [{
        name: "Nokia"
    }, {
        name: "Samsung"
    }];
	$scope.submit =function()
	{
        if($scope.favoriteStore == 'Nokia') {
            alert($('#nokia').val());
        } else {
            alert($('#samsung').val());
        }
	
	
	}  
            $http.get('*****').success(function(data, dealers, response) {
                function initialize() {
                    var serverData = data;
                    $scope.locations = [];
                    for (var i = 0; i < serverData.length; i++) {
                var modal = [
                data[i].Store_Name, data[i].S_Location.Latitude, data[i].S_Location.Longitude, i, 'images/arrow.svg', data[i]._id,data[i].Store_Type,data[i].Services];
                $scope.locations.push(modal); 
            }
					var locations = [
                ['Sakthi Nokia Store', '12.901599', '77.594563', '1', 'images/arrow.svg.svg', '55a78953815356700bee698f','Nokia','Interior Services,Exterior Services,Regular Services & Maintenance','7768578545'],
                ['Google Mobile Center', '12.9165534', '77.5474802', '2', 'images/arrow.svg.svg', '55a786d1815356700bee6982','Nokia,Samsung','Software problem & updates,Interior Services','7768578589'],
				['Zig zag mobiles', '12.9033434', '77.5574802', '3', 'images/arrow.svg.svg', '55a786d1815356700bee6982','Samsung','Hardware Problem,Interior Services,Exterior Services,Other Services','7768578547'],
				['Guptha mobile Corner', '12.9165534', '77.5456742', '4', 'images/arrow.svg.svg', '55a786d1815356700bee6982','Nokia,Samsung','Regular Services & Maintenance','7768578590'],
				];

                    var map = new google.maps.Map(document.getElementById('map'), {
                        zoom: 13,
                        center: new google.maps.LatLng(12.9667, 77.5667),
                        mapTypeId: google.maps.MapTypeId.ROADMAP
                    });



                    var marker, i;

                    for (i = 0; i < $scope.locations.length; i++) {

                        marker = new google.maps.Marker({
                            position: new google.maps.LatLng($scope.locations[i][1], $scope.locations[i][2]),
                            map: map,
                            icon: $scope.locations[i][4],
                            animation: google.maps.Animation.DROP,

                        });


                        google.maps.event.addListener(marker, 'click', (function(marker, i) {
                            return function() {


                                var compiled = $compile('<div><div>' + $scope.locations[i][0] + ' </div><div>' + $scope.locations[i][1] + ' </div><div>' + $scope.locations[i][2] + ' </div><div><button ng-click="getid(locations[' + i + '][5])">Get</button></div></div><a id="dealericon" class="icon ion-android-call"  ng-href="tel:' + $scope.locations[i][8] + '"> </a>  ')($scope);

                                var infowindow = new google.maps.InfoWindow({
                                    content: compiled[0]
                                });


                                infowindow.open(map, marker);
                                $scope.$apply();

                            }

                        })(marker, i));
                    }
                    
                    $scope.getid = function(id) {
					console.log(id)
                        
                    }

                    
                    $scope.map = map;
                }

                
            });
			}
		
    ])

0 个答案:

没有答案