Angular Password Encryption

i have created one function onSubmit(). onSubmit() password is getting encrypted and saved in database. so I want to add condition that when I edit lastname then that password field having encrypted value remain as it is its value do not change

Source: Angular Questions