1
我想在我的html中將var maplink顯示爲href。我已經輸入了值,結果是我想要顯示的地圖鏈接。我在remoteMethod中創建了maplink方法。地圖鏈接顯示在我的控制檯中,我如何讓它顯示在HTML中?我想在我的發現,location.html以顯示它 console.png如何將響應正文顯示爲html
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()
[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',
}
}
);
你能提供[mcve]嗎? – Grundy
可能更好用:[ng-map](https://ngmap.github.io/)? – Grundy