So i have a method for creating a user on my firebase db, It expects a instance of a specific model.
But I have no idea how I take the values combine them and then pass then to the function as that type.
import { Component, OnInit } from '@angular/core';
import { Entry } from '../entry.model';
import { MemberService } from 'src/app/member.service';
import { Member } from 'src/app/member.model';
@Component({
selector: 'app-register',
templateUrl: './register.component.html',
styleUrls: ['./register.component.css']
})
export class RegisterComponent implements OnInit {
entry: Entry;
member: Member;
constructor(private memberservice: MemberService) { }
ngOnInit(): void {
}
//function being called from front end button with input fields that pass values
create(surName: string, pass: string, color: string){
//Should call createMember();
//Id,Priority gets set here not by the user
}
The Service function:
createMember(member: Member){
return this.firestore.collection('members').add(member);
}
The Model
export class Member {
id: string;
surname: string;
color: string;
password: string;
priority: number;
}