我有一個彈出的離子,並有一個文本框和一個按鈕。我想按回車鍵並希望按鈕工作並關閉彈出窗口。林想知道如何在下面的這個彈出窗口中執行此操作。按Enter鍵提交與AngularJs的離子Popup
var myPopup = $ionicPopup.show({
template: '<input type = "text" ng-model = "data.model"><br> '
, title: 'Name'
, scope: $scope
, buttons: [
{
text: 'Cancel'
}, {
text: '<b>Search</b>'
, type: 'button-positive'
, onTap: function (e) {
$ionicLoading.show();
$http.get(HTTPService.getHttpText() + 'Persons/' + $scope.data.model).then(function (resp) {
console.log('Success', resp);
$ionicLoading.hide();
}, function (err) {
$ionicLoading.hide();
console.error('ERR', err);
// err.status will contain the status code
})
}
}
]
});
可能的重複[提交表單按Enter與AngularJS](http://stackoverflow.com/questions/15417125/submit-form-on-pressing-enter-with-angularjs) – Pengyy