2016-08-05 63 views
0

我需要幫助使響應成爲彈出消息,而不是讓它顯示在提交按鈕下方。如何在提交時發出離子彈出錯誤消息

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'); 
    }); 
}; 

回答

0

app.js

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

我需要grap的日期形式res.data可能看起來像這樣?模板:(res.data); – velvetInk

+0

似乎在工作 – velvetInk

+0

我需要括號嗎? – velvetInk