Skip to content

Instantly share code, notes, and snippets.

@ktpm489
Forked from codediodeio/auth.service.ts
Created July 19, 2019 17:29
Show Gist options
  • Select an option

  • Save ktpm489/6c3f0482d71293f13d680063dbef93ae to your computer and use it in GitHub Desktop.

Select an option

Save ktpm489/6c3f0482d71293f13d680063dbef93ae to your computer and use it in GitHub Desktop.
import { Injectable } from '@angular/core';
import * as firebase from 'firebase';
//...omitted
@Injectable()
export class AuthService {
resetPassword(email: string) {
var auth = firebase.auth();
return auth.sendPasswordResetEmail(email)
.then(() => console.log("email sent"))
.catch((error) => console.log(error))
}
}
<button (click)="resetPassword('hello@angularfirebase.com')">Reset Password</button>
import { Component } from '@angular/core';
import { AuthService } from "./somewhere/auth.service";
@Component({
// omitted...
})
export class ResetPasswordComponent {
resetPassword(email: string) {
this.auth.resetPassword(email)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment