如何使Angularjs ui映射平移拖动?

时间:2014-06-30 18:01:46

标签: javascript asp.net html5 angularjs google-maps

使用angular-ui-map或angular-google-map库时,即使mapOptions设置为隐式执行,地图也不会平移拖动。有没有已知的问题?

重现的代码 -

脚本

<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script>
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?v=3&libraries=drawing,places,weather&sensor=false"></script>
<script type="text/javascript" src="Scripts/angular.js"></script>
<script type="text/javascript" src="Scripts/angular-ui-event.js"></script>
<script type="text/javascript" src="Scripts/angular-ui-map.js"></script>

角 -

var Angular = angular.module('LocqusAngular', ['ui.router', 'ui.map', 'ui.event'])
Angular.controller('MapController', function ($scope) {
        $scope.markers = [];
        $scope.taskMarkers = [];
        $scope.bounds = new google.maps.LatLngBounds();
        var DefaultLatLng = new google.maps.LatLng(37.09024, -95.712891);
        $scope.mapOptions = {
            zoom: 4,
            center: DefaultLatLng,
            mapTypeId: google.maps.MapTypeId.ROADMAP,
            draggable:true
        }

HTML -

<form runat="server">
    <asp:ToolkitScriptManager ScriptMode="Release" ID="TSM" EnablePageMethods="true" CombineScripts="true" runat="server">
        <Services>
            <asp:ServiceReference Path="~/Service.asmx" />
        </Services>
    </asp:ToolkitScriptManager>
 <div id="MapRow" ng-controller="MapController">
  <div id="map_canvas" class="map-container" ui-map="map" ui-options="mapOptions"></div>
 </div>
</form>

0 个答案:

没有答案