2015-10-14 50 views
1

當點擊一個按鈕時顯示列表編輯的彈出窗口。當點擊列表中的一個項目時,模型會打開。我需要關閉模型打開時的彈出窗口,不工作。當我選擇一個選項時,離子彈出不會關閉

$scope.showPopup = function() { 
    $scope.data = {} 

    $scope.myPopup = $ionicPopup.show({ 
     template: '<div class="list padding" ng-click="edit()">Edit</div>', 
     cssClass: 'custom-class', 
     scope: $scope, 
    }); 
}; 
$scope.hidePopup = function() { 
    $scope.myPopup.close(); 
} 

$ionicModal.fromTemplateUrl('templates/modal.html', { 
    scope: $scope 
}).then(function(modal) { 
    $scope.modal = modal; 
}); 
$scope.openModal = function() { 
    $scope.hidePopup(); 
    $scope.modal.show() 
} 
$scope.closeModal = function() { 
    $scope.modal.hide() 
} 

$scope.edit = function() { 
    console.log(56646); 
    $scope.hidePopup(); 
    $scope.openModal(); 

}; 
$scope.update = function(item) { 
    $scope.closeModal 
    console.log(item); 
} 

請幫幫我嗎?

+0

你可以給一個運動員嗎? – Muhsin

+0

抱歉不能... –

+0

請給我一個html頁面嗎? – Muhsin

回答

1

打開模型時需要使用$ timeout。

$scope.showPopup = function() { 
$scope.data = {} 

$scope.myPopup = $ionicPopup.show({ 
    template: '<div class="list padding" ng-click="edit()">Edit</div>', 
    cssClass: 'custom-class', 
    scope: $scope, 
}); 
}; 
$scope.hidePopup = function() { 
    $scope.myPopup.close(); 
} 

$ionicModal.fromTemplateUrl('templates/modal.html', { 
    scope: $scope 
}).then(function(modal) { 
    $scope.modal = modal; 
}); 
$scope.openModal = function() { 
    $scope.hidePopup(); 
    $scope.modal.show() 
} 
$scope.closeModal = function() { 
    $scope.modal.hide() 
} 

$scope.edit = function() { 
    console.log(56646); 
    $scope.hidePopup(); 
    $timeout(function(){ 
     $scope.openModal(); 
    }) 

}; 
$scope.update = function(item) { 
    $scope.closeModal 
    console.log(item); 
} 
+0

謝謝...爲您的支持 –

相關問題