Is there a way to open an ionic Modal at a certain state?
I found in the ui-router docs an example using the bootstrap $modal service but I have no idea how to apply the $ionicModal service instead.
Is there a way to open an ionic Modal at a certain state?
I found in the ui-router docs an example using the bootstrap $modal service but I have no idea how to apply the $ionicModal service instead.
Try this,
$ionicModal.fromTemplateUrl('modal.html', {
scope: $scope,
animation: 'slide-in-up'
})
.then(function(modal) {
$scope.modal = modal;
$scope.modal.show();
});
This will immediately open a modal with template modal.html. Put this where the state’s controller is.
Just a minor improvement, move the $scope.modal.show() into the .then() callback.
I found this example in codepen: