Reputation: 79
Can you please tell me how to make a customized alert in ionic 2 ? like add image at top right corner make it clickable
Upvotes: 3
Views: 10649
Reputation: 1076
We Can Use Modal Instead Of using Alert by Giving Padding to Modal.. Add Modal & Write This Code In App.scss :)
ion-modal {
background-color: rgba(0, 0, 0, 0.5);
ion-content.content{
top: 20%;
left: 10%;
width: 80%;
height: 50%;
border-radius: 10px;
.scroll-content {
border-radius: 20px;
}
}
}
Upvotes: 8
Reputation: 460
I am using following to get the desired modal size.
.always-modal .modal-wrapper{
background: rgba(0, 0, 0, 0.7);
width: 100%;
height: 100%;
left: unset !important;
top: unset !important;
.ion-page{
margin:0 auto;
position: relative;
top:10%;
width: 75%;
height: 80%;
}
}
Now whenever I need a modal with these properties I pass following in modal options.
{ cssClass: "always-modal" }
I am not able to figure out how to dismiss this modal when user taps on background area.
Upvotes: 1
Reputation: 6141
For these I always just create a custom modal page. You can full control all aspects of a modal, including sizing. It's basically just a page with a controller and template, super easy to implement too.
http://ionicframework.com/docs/v2/api/components/modal/ModalController/ should get you all set
Upvotes: 1