在用angularjs做地址级联选择时,后台数据是已经发送拿到了,但点击第一次时没有显示options,第二次才会显示数据,
html:
省份
Province:{{provincename || 'None'}}
市
City:{{cityname || 'None'}}
区/县
controller:
myApp.controller("newAddressCtrl", function($scope, $state, locals, shareFactory, addressService) {
$scope.selfInfo = shareFactory.getVal("selfInfo");
var token = locals.get('token', '');
var proviceInfo = addressService.provinceService();
proviceInfo.then(function(p) {
$scope.provinces = p;
}, function(p) {
$scope.error = p;
});
$scope.requireValue = true;
$scope.telPattern = new RegExp("^[1][358][0-9]{9}$");
//点击获取对应的市
$scope.getCity = function() {
var cityInfo = addressService.cityService($scope.provincename);
cityInfo.then(function(c) {
$scope.cities = c.cities;
}, function(c) {
$scope.error = c;
})
}
$scope.getArea = function() {
var areaInfo = addressService.areaService($scope.cityname);
areaInfo.then(function(a) {
$scope.areas = a.areas;
}, function(a) {
$scope.error = a;
})
}
$scope.back = function() {
history.go(-1);
}
$scope.copyText = function() {
var saveAddress = addressService.addressSaveService(id, $scope.contacter_name, $scope.provincename.province_id, $scope.cityname.city_id, $scope.areaname.area_id, $scope.postal_code, $scope.phone_number, $scope.detailed_address, token);
saveAddress.then(function(d) {
console.log(d);
}, function(d) {
$scope.error = d;
})
}
})
求助各位大神,请问是哪里的问题?我实在是找不到了T_T
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
说关键问题啊,贴这么多代码谁有时间看啊
我想问一下,问题解决了么?