选择值后如何隐藏显示列表的离子模态?
How to hide a ionic modal that shows a list after selecting a value?
我有一个离子视图,它在模态中显示项目列表。我想在 select 一个项目后关闭模式。我使用 ng-controller 属性将模态模板与控制器相关联。
如何在我将获得点击事件的控制器中关闭模态表单?
像这样尝试
$scope.modal.hide();
如果您使用多个模式,请为范围变量指定不同的名称..
$ionicModal.
fromTemplateUrl('example.html', {
scope: $scope,
animation: 'slide-in-up' }).
then(function(modal) {
$scope.exmapleModal = modal;
$scope.exmapleModal.show();
$scope.closeExample = function() {
$scope.exmapleModal.hide();
$scope.exmapleModal.remove();
};
});
关闭同名模式
$scope.closeExample();
我有一个离子视图,它在模态中显示项目列表。我想在 select 一个项目后关闭模式。我使用 ng-controller 属性将模态模板与控制器相关联。
如何在我将获得点击事件的控制器中关闭模态表单?
像这样尝试
$scope.modal.hide();
如果您使用多个模式,请为范围变量指定不同的名称..
$ionicModal.
fromTemplateUrl('example.html', {
scope: $scope,
animation: 'slide-in-up' }).
then(function(modal) {
$scope.exmapleModal = modal;
$scope.exmapleModal.show();
$scope.closeExample = function() {
$scope.exmapleModal.hide();
$scope.exmapleModal.remove();
};
});
关闭同名模式
$scope.closeExample();