In my app.component.ts, the am using this function to register the user onto firebase using angularFire2. However I am getting an error with "property 'subscribe' does not exist on type 'void".
register() {
this.userService.registerUser(this.model)
.subscribe(
data => {
console.log('Registration successful')
},
error => {
this.loading = false;
});
}
and in my userService.ts, I have the following call getting data from firebase
registerUser(user: User) {
this.angularFire.auth.createUser({
email: user.email,
password: user.password
}).then(
(success) => {
console.log(success);
}).catch(
(err) => {
console.log(err);
})
}
I do understand why the error appears. Because my registerUse function in the userService does not return an observable. As I am new to typescript, how can I change that to become an observable such that I can console.log('Success') in the app.component.ts when the data comes back?