-
Notifications
You must be signed in to change notification settings - Fork 13.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add possibility to close popup from directive. #854
Comments
Possibility: Change popup API a bit, creating our own 'then' and also adding a close function. var pop = $ionicPopup.show(...)
pop.then(function(response) {
});
$scope.closePopEarly = function() {
pop.close();
}; |
That was fast:) Thanks I'll try.. when it will be ready ;) |
It isn't implemented yet, it's an idea for implementing what you want though. |
I'll take a look at this one. Thanks Andy, good idea |
Okay, took a slightly different approach for now: $ionicPopup.show(...)
.then(function(response) {
}, function(err) {},
function(popup) {
}); You'll get the constructed popup in the notify function of the promise. We should probably revisit this API later. |
Hey guys, First of all: Awesome job on the Ionic project. It's really great :D I'm trying to close the popup but with no success. Here's what I tried:
var popup = $ionicPopup.show({
templateUrl: 'view/dialog/med_reminder.html',
title: "Title",
scope: $scope,
buttons: [
{ text: 'ready', onTap: function(e) { return true; } }
]
}).then(function(response) {
$scope.handle_user_response(response);
});
popup.close(true); // returns undefined is not a function
$ionicPopup.show({
templateUrl: 'view/dialog/med_reminder.html',
title: 'Enter Wi-Fi Password',
subTitle: 'Please use normal things',
scope: self.root_scope,
buttons: [
{ text: 'Cancel', onTap: function(e) { return false; } },
{
text: '<b>Save</b>',
type: 'button-positive',
onTap: function(e) {
return true;
}
},
]
}).then(function(res) {
console.log('Tapped!', res);
}, function(err) {
console.log('Err:', err);
}, function(popup) {
// If you need to access the popup directly, do it in the notify method
// This is also where you can programatically close the popup:
popup.close();
}); Here the last function where the popup.close() is. Is never fired. Am I missing something or has this function been removed from the new nightlies? Thanks in advance |
PS: tried last beta (Cadnium Camel) as well with same results |
You can't use This is how it should be done: var popup = $ionicPopup.show(..);
popup.then(...);
popup.close(); |
This should probably be clarified more in the docs. |
@ajoslin thanks man! That fixed it. |
Close only works with $ionicPopup.alert :( |
I wanted to close all the popups before leaving the screen. This is how I did it.
|
You need to add possibility to close popup from code (not just buttons).
I'll use dangeross' example: http://codepen.io/dangeross/pen/wvAjJ/2
Open modal and then Add popup.
Should close popup after clicking option. Now I have to make two taps.
The text was updated successfully, but these errors were encountered: