Last active
July 12, 2017 20:52
-
-
Save harrylincoln/cdbc755592db032d374758f7298d5d8c to your computer and use it in GitHub Desktop.
Extended component with createNewUser function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Component } from '@angular/core'; | |
import { AngularFireDatabase, FirebaseListObservable } from 'angularfire2/database'; | |
import { AF } from '../providers/af'; | |
import { HttpModule } from '@angular/http'; | |
import { Observable } from 'rxjs/Observable'; | |
import { AngularFireAuthModule, AngularFireAuth } from 'angularfire2/auth'; | |
@Component({ | |
selector: 'app-root', | |
templateUrl: './app.component.html', | |
styleUrls: ['./app.component.css'] | |
}) | |
export class AppComponent { | |
public items: FirebaseListObservable<any[]>; | |
public user: FirebaseListObservable<any>; | |
constructor(db: AngularFireDatabase, public afService: AF, public afAuth: AngularFireAuth) { | |
this.afAuth.authState.subscribe(res => { | |
if (res && res.uid) { | |
this.user = db.list('users/' + res.uid); | |
} | |
}); | |
} | |
createNewUserHit(event) { | |
event.preventDefault(); | |
this.afService.createNewUser('testy@testy.com', 'aSaf3rp@a55word!') | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment