2016-04-04 35 views
1

Var maplink'i htmlimde href olarak görüntülemek istiyorum. Değerleri zaten girdim ve sonuç göstermek istediğim maplink. RemoteMethod'da maplink yöntemini oluşturdum. Maplink konsolumda görüntülenir, html'de görüntülenmesini nasıl sağlayabilirim? Benhtml'ye yanıt gövdesi nasıl görüntülenir

 [GeoCode.remoteMethod(
    'geocode', { 
     http: { 
     path: '/geocode', 
     verb: 'post' 
     }, 
     accepts: \[{ 
     arg: 'address', 
     type: 'string', 
     required: true 
     }, { 
     arg: 'city', 
     type: 'string', 
     required: true 
     }, { 
     arg: 'zipCode', 
     type: 'string', 
     required: true 
     }\], 
     returns: { 
     arg: 'maplink', 
     type: 'string', 
     } 
    } 
); 
+0

[mcve] sağlayabilir misiniz? – Grundy

+0

muhtemelen daha iyi kullanım: [ng-map] (https://ngmap.github.io/)? – Grundy

cevap

0

)

var maplink = "http://maps.google.com/?q=" + lat + "," + lng; 
    console.log('maplink is ' + maplink); 
    // make a callback function cb 
    cb(null, maplink); 

remoteMethod ( console.png

geocode.js benim buluntu location.html görüntülemek

angular 
.module('app') 
.controller('FindLocationController', ['$scope', '$state', 'GeoCode', function ($scope, $state, GeoCode) { 
    $scope.GeoCodes = []; 

    $scope.submitForm = function() { 
     GeoCode 
      .geocode({ 
       address: $scope.geoCode.address, 
       zipCode: $scope.geoCode.zipCode, 
       city: $scope.geoCode.city,     
      }) 
      .$promise 
      .then(function() { 
       $state.go('find-location'); 
      }); 
    }; 
}]) 

geocode.js istiyorum Angular.element yöntemini kullanarak gövdeyi seçin ve ona maplink ekleyin. Aşağıdaki kodu kontrol edin.

var maplink = "http://maps.google.com/?q=" + lat + "," + lng; 
console.log('maplink is ' + maplink); 
// Append maplink to body 
var body = angular.element(document.querySelector('body')); 
body.append(maplink); 
// make a callback function cb 
cb(null, maplink); 
+0

Başka bir sekme açmak için bir işlev olarak görüntülemek için konsolu belirli bir sonuç alır mı? (google API sonucu) – sxxxxxxx

İlgili konular