2
我有一个带有输入文本的表单视图。当我点击这个输入时,另一个视图被打开。不同视图上的离子返回值导航
在这个视图中,有一个输入搜索和一个列表。当我更改输入搜索中的文本时,列表发生更改。
我希望当我点击列表中的一个项目时,这个视图被关闭并且输入文本改变。但我不知道我该怎么做。
你能帮助我吗?
输入文本在我的表单视图:为什么不使用$ionicModal
'Use Strict';
angular.module('App').controller('setlocationController', function ($scope,$state, $cordovaOauth, $localStorage, $location, $http, $ionicPopup,$firebaseObject,$ionicHistory, Auth, FURL, Utils) {
$scope.getGeocode = function (addresssearch) {
$scope.geodata = {};
$scope.queryResults = {};
$scope.queryError = {};
$http.get('https://maps.googleapis.com/maps/api/geocode/json?address=' + addresssearch)
.then(function (_results) {
$scope.addresslist = [];
$scope.queryResults = _results.data.results;
console.log($scope.queryResults);
$scope.queryResults.forEach(function(result) {
$scope.addresslist.push({ 'address': result.formatted_address, 'location': result.geometry.location });
});
},
function error(_error){
$scope.queryError = _error;
})
};
// Here I want when I click one item of the list, this view gets closed and the input text of formview change.
$scope.setaddress = function (addr) {
$scope.setaddress = addr;
$ionicHistory.backView();
}
请分享一下您已经开发的代码(包括JS和HTML) –
tx。我编辑了我的帖子。所以我的问题是在setaddress函数中。 – user3884677