如何在提交时创建离子弹出错误消息

时间:2016-08-05 02:35:55

标签: ionic-framework

我需要帮助才能使响应成为弹出消息,而不是将其显示在提交按钮下方。

template.html

<div class="item item-text-wrap">
                        Response: <b ng-bind="response"></b>
                    </div>

app.js

$http.post(link, {
          inputName : $scope.data.inputName

        }).then(function (res){
           $scope.response = res.data;
        });

app.js我想将此弹出对话框添加到响应消息

// An alert dialog
 $scope.showAlert = function() {
   var alertPopup = $ionicPopup.alert({
     title: 'Don\'t eat that!',
     template: 'It might taste good'
   });

   alertPopup.then(function(res) {
     console.log('Thank you for not eating my delicious ice cream cone');
   });
 };

1 个答案:

答案 0 :(得分:0)

app.js

$http.post(link, {
  inputName : $scope.data.inputName
}).then(function (res){
  // $scope.response = res.data;
  $ionicPopup.alert({
    title: 'Success!',
    template: res.data
  });
});