When delving into Firestore for the first time, I quickly learned that the recommended modeling approach looks something like this: check out the model here
members {
id: xyz
{
name: Jones;
hashtag: {
global: true,
digital: true
}
...
}
My goal is to capture user input from a "hashtag" form field and use it as a key in the hashtag property, automatically assigning the value "true" to that key using Angular 6 (Typescript). Here's how I'm currently trying to achieve this:
submit(newName: string, newHashtag: string) {
if ( newName !== '' && newHashtag !== '') {
this.member.name = newName;
this.member.hashtag = { newHashtag: true};
console.log(this.member);
// this.membersService.addMember(this.member);
}
}
However, when running the program, it consistently outputs "newHashtag" instead of the desired input value. How can I resolve this issue?
export interface Member {
id?: string;
name?: string;
hashtag?: object;
}
<form>
<input type="text" placeholder="new Name" #memberName name="name">
<input type="text" placeholder="new hashtag" #hashtagName name="name">
<button (click)="submit(memberName.value, hashtagName.value);
memberName.value=''">Submit</button>
</form>>