Ich möchte die Var Maplink als href in meinem HTML anzeigen. Ich gebe die Werte bereits ein und das Ergebnis ist der Maplink, den ich anzeigen möchte. Ich habe die Maplink-Methode in remoteMethod erstellt. Der Maplink wird in meiner Konsole angezeigt, wie kann ich ihn in HTML anzeigen lassen? Ich will es console.pngWie Antwortkörper in HTML anzuzeigen
geocode.js
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
var maplink = "http://maps.google.com/?q=" + lat + "," + lng;
console.log('maplink is ' + maplink);
// make a callback function cb
cb(null, maplink);
remoteMethod() in meinem Fund-location.html anzuzeigen
[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',
}
}
);
Können Sie [mcve] bereitstellen? – Grundy
möglicherweise besser verwenden: [ng-map] (https://ngmap.github.io/)? – Grundy