Tuesday, June 18, 2024
Angular 9Bootstrap 4ngx smart popover

Angular 9 Popover Login Form working code

Angular 9, Angular 10

Hello to all, welcome to In this post, I will tell you, Angular 9 Popover Login Form working code.

Here is the working code snippet and please use carefully and if you have any kind of query then please comment below:

1. Very first you have to run below command into your terminal to install popover module into your Angular 9 application:

npm install ngx-smart-popover --save

2. After done with above command, you have write below code into app.module.ts file:

import { PopoverModule } from "ngx-smart-popover";

imports: [


3. Now you have to write below code into your app.component.ts file:

<div class="text-center">
  <h3>Angular Popover Login Form:</h3>
<div class="container text-center mb-4">

  <popover-content #myPopover 
                title="Login Form" 
                placement="right top"
  <form [formGroup]="registerForm" (ngSubmit)="onSubmit()">
            <div class="form-group">
                <input type="text" formControlName="email" class="form-control" [ngClass]="{ 'is-invalid': submitted && }" />
                <div *ngIf="submitted &&" class="invalid-feedback">
                    <div *ngIf="">Email is required</div>
                    <div *ngIf="">Email must be a valid email address</div>
            <div class="form-group">
                <input type="password" formControlName="password" class="form-control" [ngClass]="{ 'is-invalid': submitted && f.password.errors }" />
                <div *ngIf="submitted && f.password.errors" class="invalid-feedback">
                    <div *ngIf="f.password.errors.required">Password is required</div>
                    <div *ngIf="f.password.errors.minlength">Password must be at least 6 characters</div>
          <button type="submit" class="btn btn-primary">Submit</button>
<button [popoverOnHover]="false"  [popover]="myPopover" class="btn btn-primary">Please Click to Login</button>



4. Finally you have to write below code into your app.component.ts file:

import { Component, OnInit } from '@angular/core';
import { FormBuilder, FormGroup, FormControl, Validators} from '@angular/forms';
  selector: 'app-ngx-bootstrap',
  templateUrl: './ngx-bootstrap.component.html',
  styleUrls: ['./ngx-bootstrap.component.css']
export class AppComponent implements OnInit {

  registerForm: FormGroup;
  submitted = false;
  constructor(private formBuilder: FormBuilder) { }
  // convenience getter for easy access to form fields
get f() { return this.registerForm.controls; }
onSubmit() {
    this.submitted = true;
    // stop here if form is invalid
    if (this.registerForm.invalid) {
  ngOnInit(): void {
  this.registerForm ={
        email: ['', [Validators.required,]],
        password: ['', [Validators.required, Validators.minLength(6)]]



I have used Bootstrap 4 in it and you can check my old post and also add Bootstrap 4.

If you have any query then please let me know.


Thank you

the authortherichpost
Hello to all. Welcome to Myself Ajay Malhotra and I am freelance full stack developer. I love coding. I know WordPress, Core php, Angularjs, Angular 14, Angular 15, Angular 16, Angular 17, Bootstrap 5, Nodejs, Laravel, Codeigniter, Shopify, Squarespace, jQuery, Google Map Api, Vuejs, Reactjs, Big commerce etc.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.