title: Implementing bcrypt in Angular 7
body: <p>I'm trying to use bcrypt with Angular7 to store an encrypted password in MySQL.</p>
  
  <p>I have used <code>npm install bcrypt</code> to install bcrypt and importing it like so
  <code>import * as bcrypt from 'bcrypt';</code>.</p>
  
  <p>Everything is compiling fine till this point; it fails to do so when I add <code>bcrypt.hash()</code></p>
  
  <p>The entire code for the login.component.ts file is below:</p>
  
  <pre><code>import { Component, OnInit } from '@angular/core';
  import { FormBuilder, FormGroup, Validators } from '@angular/forms';
  import * as bcrypt from 'bcrypt';
  
  @Component({
    selector: 'app-login',
    templateUrl: './login.component.html',
    styleUrls: ['./login.component.scss']
  })
  
  export class LoginComponent implements OnInit {
  
  loginForm : FormGroup;
  success = false;
  loginFailed = false;
  
  constructor(private formBuilder : FormBuilder) { }
  
  ngOnInit() : void {
  
      this.loginForm = this.formBuilder.group({
        username: ['', Validators.required],
        password: ['', Validators.required]
      });
  }
  
  DoLogin()
  {
      console.log(this.loginForm.value);
  
      pass = bcrypt.hash('Pass@123', 10); // App is not compliling when I add this line //
  }
  </code></pre>
  
  <p>How do I call the methods in bcrypt?</p>