ui-angular模态窗口直接位置到主html谷歌地图

时间:2015-04-20 06:53:22

标签: angularjs angular-ui angular-ui-bootstrap angular-google-maps

我需要帮助点击模态窗口中的数据并将其位置显示为主html。它的工作原理如下。在我的主页面上有一个带按钮的默认地图可以弹出模态窗口,这个模态窗口将显示一组位置的一行数据。点击此地点将关闭模式并刷新主页上的googlemap并显示地点位置。在这里我的代码:

   .controller('Controller1', function($scope, $modal, $log, $interval,CRUD) {
      $scope.map={}
      $scope.refreshMap = function () {
        $scope.map.control.refresh({latitude: 32.779680, longitude: -79.935493});
        $scope.map.control.getGMap().setZoom(11);
        return;
      };
      var getJobs = CRUD.all();
            getJobs.success(function(response){
               $scope.jobs = response.Jobs;
            });
          $scope.open = function (size) {

            var modalInstance = $modal.open({
              templateUrl: 'js/templates/myJobModalContent.html',
              controller: 'ModalInstanceCtrl1',
              size: size,
              scope: $scope,
              resolve: {
                jobs: function () {  
                  return $scope.jobs;
                }
              }
            });
            modalInstance.result.then(function (selectedItem) {
              $scope.selected = selectedItem;

            }, function () {

              $log.info('Modal dismissed at: ' + new Date());
            });
         };
    }
    .controller('ModalInstanceCtrl1', function ($scope, $modalInstance, jobs) {
      $scope.posts = jobs;
      $scope.selected = {
        post: $scope.posts[0]
      };
      $scope.ok = function () {
        alert("you selected  "+$scope.selected.post.cust_location.latitude+" "+$scope.selected.post.cust_location.longitude);            
        $modalInstance.dismiss('ok');
      };

      $scope.cancel = function () {
        $modalInstance.dismiss('cancel');
      };

      $scope.showlocation = function () {
        //*need here to show location or if possible goto $scope.refreshMap() function that declare on previous function
      });

0 个答案:

没有答案
相关问题