DEV Community

Nagarajan R
Nagarajan R

Posted on

Answer: Implementing bcrypt in Angular 7

You can install bcryptjs (npm install bcryptjs) and use the following code:

import * as bcrypt from 'bcryptjs';

const salt = bcrypt.genSaltSync(10);
pass = bcrypt.hashSync(this.loginForm.value.password, salt);

Your code must look like:

import { Component, OnInit } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import *

Top comments (0)