折线在ngmap中没有更新

时间:2015-12-07 21:13:04

标签: javascript angularjs ng-map

我有一张使用ngmap的地图。通过表格我得到一个数据集并在地图中表示。当我请求新数据集时,地图显示标记但不显示行。这是我的代码的一部分。

JS:

hantow

HTML:

var app = angular.module('dataview', ['ngMap', 'ngSanitize'])

app.controller('DataViewCtrl', function($scope, $http)
{
  $scope.makemap = function()
    {
     $scope.polyline = [];

     $scope.graph_data.map(function(item)
      {    
      var gpsarr = [item['latitude'], item['longitude'], 'http://maps.gstatic.com/intl/en_us/mapfiles/markers2/measle_blue.png', new Date(item[0])];
                       
$scope.polyline.push(gpsarr);
     }
          
$scope.polyline[0][2]='http://maps.google.com/mapfiles/ms/icons/green-dot.png';
$scope.polyline[$scope.polyline.length-1][2]='http://maps.google.com/mapfiles/ms/icons/red-dot.png';
   }          
});

第一次结果正确(查看标记和线条)

enter image description here

第二次结果不正确(显示新标记但没有新行)

enter image description here

0 个答案:

没有答案