@ViewChild(MatSort) sort: MatSort;
   @ViewChild(MatPaginator) paginator: MatPaginator;
   @Output() passBackSelectedUser: EventEmitter<any> = new EventEmitter();
+  @Output() userNotFoundFlag = new EventEmitter<boolean>();
   searchString: string;
   txtResults = 'result';
   searchUsersResults: any;
   selectedUser: any;
   displayedColumns: string[] = ['firstName'];
   dataSourceMap = new MatTableDataSource(this.searchUsersResults);
+  submitted = false;
+  message = " No users found with your query. Please change your search and try again.";
 
   ngOnInit() {
     this.searchString = '';
       this.passBackSelectedUser.emit(systemUser);
   }
 
+  noUserFlag: boolean = false;
   searchUsers() {
     if (!this.isSystemUser) {
       this.isLoading = true;
       this.userService.searchUsers(this.searchString).subscribe((_data: PortalAdmin) => {
         this.searchUsersResults = _data;
         if (this.searchUsersResults == null || this.searchUsersResults.length == 0) {
-          const modelRef = this.ngModal.open(ConfirmationModalComponent)
-          modelRef.componentInstance.title = "Confirmation";
-          modelRef.componentInstance.message = " No users found with your query. Please change your search and try again."
+          this.noUserFlag = true;
           this.isLoading = false;
         } else {
+          this.noUserFlag = false;
           this.showUserTable = true;
           this.isLoading = false;
           this.dataSourceMap = new MatTableDataSource(this.searchUsersResults);
     this.passBackSelectedUser.emit(this.selectedUser);
   }
 
+  addNewUser() {
+    console.log("Emit the value to parent");
+    this.userNotFoundFlag.emit(true);
+  }
+
 }
 
 import { FormBuilder, FormGroup, Validators } from '@angular/forms';
 import { MustMatch } from 'src/app/shared/helpers/must-match-validator';
 import { UsersService } from 'src/app/shared/services';
-import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
+import { NgbActiveModal, NgbModal } from '@ng-bootstrap/ng-bootstrap';
+import { ConfirmationModalComponent } from 'src/app/modals/confirmation-modal/confirmation-modal.component';
 
 @Component({
   selector: 'app-user-details-form',
   addNewUserForm: FormGroup;
   submitted = false;
 
-  constructor(private formBuilder: FormBuilder, 
+  constructor(private formBuilder: FormBuilder,
     private usersService: UsersService,
-    public activeModal: NgbActiveModal) { }
+    public activeModal: NgbActiveModal,
+    public ngbModal: NgbModal) { }
 
   ngOnInit() {
     this.addNewUserForm = this.formBuilder.group({
       lastName: ['', Validators.required],
       email: ['', [Validators.required, Validators.email]],
       loginId: ['', Validators.required],
-      loginPwd: ['', [Validators.required, Validators.minLength(6)]],
+      loginPwd: ['', Validators.required],
       confirmPassword: ['', Validators.required]
     }, {
         validator: MustMatch('loginPwd', 'confirmPassword')
     console.log("New user Json : " + JSON.stringify(this.addNewUserForm.value));
     console.log("Get Raw value : " + this.addNewUserForm.getRawValue());
     let newUserFormData = JSON.stringify(this.addNewUserForm.getRawValue());
-    this.usersService.addNewUser(newUserFormData);
+    this.usersService.addNewUser(newUserFormData).subscribe(result => {
+      console.log("Result : ", result);
+      const modalSuccess = this.ngbModal.open(ConfirmationModalComponent);
+      modalSuccess.componentInstance.title = "Success";
+      modalSuccess.componentInstance.message = 'User added Successfully!';
+    }, error => {
+      console.log("Error : ", error);
+      const modalErrorRef = this.ngbModal.open(ConfirmationModalComponent);
+      modalErrorRef.componentInstance.title = "Error";
+      modalErrorRef.componentInstance.message = 'Something went wrong. Error Message: ' + error.message;
+    })
     this.activeModal.close();
   }