I have a projet where i want to use this type of login :
I have set up a modal correctly and i can dismiss it with no problem, but my problem is that it take the entire page, and i just want it to be as in the picture.
I don't know how to select all page in css file, already tried with * but it messing too much with what is inside the html file.
thank you in advance !
Edit :
code on the page that open the modal :
showLogin() {
let modal = this.modalCtrl.create(LoginPage);
// this.navCtrl.push(modal);
modal.present();
}
code of the modal : HTML :
<ion-navbar class="modal-wrapper" *navbar>
<ion-title>Sample Modal</ion-title>
</ion-navbar>
<ion-content padding class="sample-modal-page">
<p>my sample modal page<p>
<ion-buttons start>
<button (click)="dismiss()">
Cancel
</button>
</ion-buttons>
</ion-content>
CSS :
page-login {
.modal-wrapper {
padding: 30px;
background: rgba(0,0,0,0.5);
}
}
TS :
import { Component } from '@angular/core';
import { NavController, NavParams, ViewController } from 'ionic-angular';
@Component({
selector: 'page-login',
templateUrl: 'login.html'
})
export class LoginPage {
constructor(public navCtrl: NavController, public navParams: NavParams,public viewCtrl: ViewController) {}
dismiss(data) {
this.viewCtrl.dismiss(data);
}
}
My mistake is probably between html and css
I got it finnaly, i was not selecting the right attribute.
Here what worked :
Thank you to varun aaruru for helping me and all the caracteristic he gave for nice editing
here you can also find a nice post talking about how to nicely design it : https://forum.ionicframework.com/t/custom-modal-alert-with-html-form/47980/19
My solution to this:
Add this to your scss:
Or this css, which will propose dynamic height:
I just set a class to modal element when it is called and change the style.
check this fiddle
change values as needed
For Modal to show up in partial screen, you'll have to remove the ion-content tag and replace with a div. This is because ionic gets confused when there are two ion-content tags.
In this case there is one in the parent and one in the child modal. So its best to take it out of the child modal. Rest of the code remains same.