Javascript 离子/角度传单指令-放大/缩小按钮不起作用

Javascript 离子/角度传单指令-放大/缩小按钮不起作用,javascript,angularjs,leaflet,ionic-framework,Javascript,Angularjs,Leaflet,Ionic Framework,我对传单地图上的默认放大/缩小按钮有一些问题。当我直接加载页面时,一切正常,但当我将一个状态更改为传单指令所在的状态时,按钮就不起作用了。给你一个例子 守则: HTML <html ng-app="app"> <head> <meta charset="utf-8"/> <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-sc

我对传单地图上的默认放大/缩小按钮有一些问题。当我直接加载页面时,一切正常,但当我将一个状态更改为传单指令所在的状态时,按钮就不起作用了。给你一个例子

守则:

HTML

<html ng-app="app">
    <head>
        <meta charset="utf-8"/>
        <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width"/>
        <link href="http://code.ionicframework.com/1.0.0-beta.11/css/ionic.min.css" rel="stylesheet"/>
        <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.css" />
        <title>Leaflet example</title> 
    </head>
    <body>
        <ion-nav-view></ion-nav-view>

        <script type="text/ng-template" id="locations.html">
          <ion-view title="Locations">
            <ion-content>
                <ion-list can-swipe="true">
                    <ion-item ng-click="locationOnClick(location)" class="item item-icon-left" ng-repeat="location in locations">
                        <i class="icon ion-location"></i>
                        <h2>{{location.name}}</h2>
                    </ion-item>
                </ion-list>
            </ion-content>
          </ion-view>
        </script>
        <script type="text/ng-template" id="location.html">
          <ion-view title="{{location.name}}">
            <ion-nav-bar class="bar-positive" animation="nav-title-slide-ios7">
                <a ui-sref="locations" class="button icon-left ion-chevron-left button-clear ">Locations</a>
            </ion-nav-bar>
            <ion-content>
                <leaflet height="480px"></leaflet>
            </ion-content>
        </ion-view>
        </script>
        <script src="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.js"></script>
        <script src="http://code.ionicframework.com/1.0.0-beta.11/js/ionic.bundle.min.js"></script>
      <script src="http://tombatossals.github.io/angular-leaflet-directive/dist/angular-leaflet-directive.min.js"></script>
    </body>                                                                
</html>    

似乎爱奥尼亚在触摸事件处理程序上有一个bug。 然而,我的一位同事想出了一个解决办法,直到它得到修复

基本上,使用他版本的ionic.bundle.js()并将“data do not set coordinates=“true”添加到每个可能链接到地图的标记中

{{location.name}

解决方案很简单。爱奥尼亚正在“吃掉”所有不是由框架创建的点击事件。对于传单地图的容器,需要添加属性
data tap disabled=“true”


是的,我来这里也是想说同样的话。很高兴你发现,不得不深入到源代码比我看到的评论说这=/
angular.module('app', [
  'ionic',
  'leaflet-directive'
])
  .config(function($stateProvider, $urlRouterProvider) {
      $stateProvider
          .state('locations', {
              url: "/locations",
              templateUrl:"locations.html",
              controller: 'LocationsCtrl'
          })
          .state('location', {
              url: "/location/:locationId",
              templateUrl: "location.html",
              controller: 'LocationCtrl'
          });


      // if none of the above states are matched, use this as the fallback
      $urlRouterProvider.otherwise('/locations');

  })
.factory('locationService', function(){
  var _locations = [{
        id: 1,
        name: 'Sample location',
        lat: 50,
        lng: 50
      }];
  return {
    getAll: function(){
      return _locations;
    },
    getById: function(id){
      return _locations.filter(function(loc){ return loc.id === id; })[0];
    }
  }
})
.controller('LocationsCtrl', function($scope, $location, locationService){
  $scope.locations = locationService.getAll();

  $scope.locationOnClick = function(location){
    $location.path('/location/'+location.id);
  };
})
.controller('LocationCtrl', function($scope, $stateParams, locationService){
  $scope.location = locationService.getById($stateParams.locationId);
})
 <h2 data-do-not-set-coordinates="true">{{location.name}}</h2>
<ion-content data-tap-disabled="true">
    <leaflet height="480px"></leaflet>
</ion-content>