在我的控制器中,我有一个$ http调用,它返回一个json字符串,然后我要将它传递给要添加到地图的指令。该字符串正在从控制器传递到指令罚款,但不是从控制器中的$ http函数传递到指令。将范围数据从函数传递给父范围?
wmm.controller('wapMapClr', ['$rootScope', '$scope', '$window', '$http', function ($rootScope, $scope, $window, $http) {
$scope.geobj = {};
$scope.geobj.geoprop = ""
// Search by postcode
// create a blank object to hold our form information
$scope.formData = {};
$scope.pcSearch = function() {
$scope.data = {};
$http.post('api/api.php', { postcode: $scope.formData })
.success(function (result) {
$scope.geobj = {geoprop : result.json_string};
console.log($scope.geobj.geoprop);
任何帮助将非常感激。由于
你得到任何错误? – Thalaivar
嗨,我没有得到任何错误 - 只是空的字符串。 – Robert