Chris Straw
SHARE:

Angular Copy/Paste – Get selected values from a FormArray

Just a code snippet for copy/paste using a map & filter from a FormArray

  get selected(): Array<CodeValue> {
    const vals = this.entryForm.value.tags
      .map((item: any, idx: number) => {
        return item.selected === true ? new CodeValue({ id: item.id, name: this.tags[idx].name }) : null
      }).filter((v: CodeValue | null) => v !== null);

    return vals;
  }