how can i use getComapny() in save() méthode in the same component ts ?
CompanyUserDialogComponent.ts :
@Component({
    selector: 'jhi-company-user-dialog',
    templateUrl: './company-user-dialog.component.html'
})
export class CompanyUserDialogComponent implements OnInit {
    constructor(
    ) {     
    }
    save() {
        console.log(this.user)
        this.doNotMatch = null;
        this.isSaving = true;
        if (this.user.password !== this.confirmPassword) {
            this.doNotMatch = 'ERROR';
        }else if (this.user.id !== null) {
            this.userService.update(this.user).subscribe((response) =>
             this.onSaveSuccess1(response), () => this.onSaveError());
        } else {
            this.userService.create(this.user).subscribe((response) =>{
                console.log(response);
                this.onSaveSuccess1(response), () => this.onSaveError()
            });
        }
    }
CompanyUserPopupComponent.ts :
@Component({
    selector: 'jhi-company-user-popup',
    template: ''
})
export class CompanyUserPopupComponent implements OnInit, OnDestroy {
    a:any
    routeSub: any;
    constructor(
        private route: ActivatedRoute,
        private companyPopupService: CompanyPopupService,
        private userModalService: UserModalService,
        private companyService: CompanyService,
    ) {}
    ngOnInit() {
        this.routeSub = this.route.params.subscribe((params) => {
            this.getComapny(params['id'])
            if ( params['login'] ) {
                this.userModalService.open(CompanyUserDialogComponent as Component, params['login']);
            } else {
                this.userModalService.open(CompanyUserDialogComponent as Component);
            }
        });     
    }
    getComapny(id:number){
        this.companyService.find(id).subscribe(res=>{
            console.log(res)
        })
      }
    ngOnDestroy() {
        this.routeSub.unsubscribe();
    }
}
 
    