title: Update password of firebase
body: <p>I want to add functionality of changing password of firebase in angular ts. In my component i am calling function of changing password from submit button. </p>
  
  <pre><code>passwordChange(form: NgForm) {
  const npassword = form.value.npassword;
  const rpassword = form.value.rpassword;
  
  if(npassword == rpassword){
  this.authService.passwordChangeUser(npassword);
  
  }
  else{
  alert("Password didnt match!");
  }
  
  }
  </code></pre>
  
  <p>from this component im calling my authService function passwordChangeUser with a parameter of npassword(new password). Here is my authService.ts </p>
  
  <pre><code>  passwordChangeUser(npassword : string ){
    var user = firebase.auth().currentUser;
  
     user.updatePassword(npassword).then(function() {
       this.router.navigate(['/dashboard']);
       alert("successfully added!");
     console.log("successfully added!");
      }).catch(function(error) {
     console.log("unsuccessfull");
    alert("unsuccessful");
    });
   }
  </code></pre>
  
  <p>But this always show me unsuccessfull. It does not update password. I dont know what is the problem . Please help me how can i update my password. Any help will be appreciated Thankyou. </p>