【问题标题】:Can I send data from Ionic JS Popup?我可以从 Ionic JS Popup 发送数据吗?
【发布时间】:2017-08-07 07:47:48
【问题描述】:

我尝试构建 android 并在某些页面中从弹出窗口中进行编辑。例如,如果我单击输入,它将显示弹出窗口并在弹出窗口中找到输入文本。输入一些文本并单击确定后,输入文本中的数据将被发送到服务器。但我不知道怎么做。

这是我的 HTML

<input class = "button" ng-click = "showPopup()">Add Popup Show />

这是我的JS

$scope.showPrompt = function() {

      var promptPopup = $ionicPopup.prompt({
         title: 'Title',
         template: 'Template text',
         inputType: 'text',
         inputPlaceholder: 'Placeholder'
      });

      promptPopup.then(function(res) {
         console.log(res);
      });

   };

谁能帮我解决我的问题?谢谢

【问题讨论】:

    标签: javascript android jquery


    【解决方案1】:

    我用过 ionicPopup 秀(希望对你有帮助):

    $scope.updateQ = function() {
        var alertpop = $ionicPopup.show({
            title: 'Quantity',
            templateUrl: 'popup-template.html',
            scope: $scope,
            buttons: [{
                text: '<p class="popup-p">Ok</p>',
                type: 'button-positive',
                onTap: function(e) {
    
                    //window.localStorage.setItem("tmpqty",$scope.product.quantity);
                    return $scope.product.quantity;
                }
            }, {
                text: '<p class="popup-p">Cancel</p>',
                type: 'popup-close',
                onTap: function(e) {
                    //alert($scope.product.quantity);
                    //return 'cancel button'
                    $state.go('app.productdetail', { product_id: $scope.product_id }, { reload: false })
                }
            }]
        });
        alertpop.then(function(res) {
            var tmp_qty = res;
            var pid = $scope.product_id;
            var url = "" + base_url + "?callback=JSON_CALLBACK&store=1&service=updatevproducts&productid=" + pid + "&qty=" + tmp_qty + "";
            $http.jsonp(url)
                .then(function(response) {
                    var stat = response.data;
                    if (stat.status == "success") {
    
                        var successPop = $ionicPopup.alert({
                            template: 'Inventory of Product Id : ' + pid + ' updated successfully !'
                        });
                        $state.go('app.stocks');
    
                    } else {
                        $state.go('app.productdetail', { product_id: $scope.product_id }, { reload: false });
                    }
                });
        });
    };
    

    【讨论】:

      猜你喜欢
      • 2021-11-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-04-08
      • 1970-01-01
      相关资源
      最近更新 更多