How to validate form while button click

How to validate a form while button click. Actually i want to do if any field is empty when i click on a submit button there i want a alert message like this field is required. how can i do that
Please help me out
Thanks

here is an example
html file

<form [formGroup]='userForm' (ngSubmit)='goHomePage()'>
        <div class="input_div">
            <ion-item class="ip" [class.invalid]=" formFlag? !userForm.controls.username.valid : null ">
                <ion-input placeholder="Email Or Username" type='email' formControlName='username'></ion-input>
                <img src="assets/imgs/small_user.png" item-right>
            </ion-item><br>
            <ion-item class="ip" [class.invalid]=" formFlag? !userForm.controls.password.valid : null ">
                <ion-input placeholder="Password" formControlName='password' type='password'></ion-input>
                <img src="assets/imgs/key.png" item-right>
            </ion-item>
        </div>
        <div class="button_div">
            <button ion-button round class="btn">LOGIN</button>
        </div>
    </form>

ts file

goHomePage(){
    this.formFlag = true;
    if(this.userForm.valid) {
        logic if form is valid
    }
  }

css file

.invalid{
        border: 1px solid color($colors, err) !important;
}