我在 FormGroup 中使用 FormControl 对象在 Angular 中创建反应式表单。当我将原始参数作为 HTML 输入选择控件的值传递时没有问题。但是,当我传递一个自定义类的对象时,FormControl中的值被减少为[object Object]。
我正在使用的系统包括:Angular CLI:7.1.4;节点:10.15.0;角度:7.1.4;rxjs 6.3.3; 打字稿 3.1.6;网络包 4.23.1;Linux rdz1 4.15.0-43-generic #46-Ubuntu SMP Thu Dec 6 14:45:28 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
import { Component, OnInit } from '@angular/core';
import { FormGroup, FormControl } from '@angular/forms';
@Component({
selector: 'app-header-notes',
templateUrl: './header-notes.component.html',
styleUrls: ['./header-notes.component.css']
})
export class HeaderNotesComponent implements OnInit {
ndcForm = new FormGroup({
noteType: new FormControl(''),
noteDate: new FormControl(''),
noteFor: new FormControl(''),
noteTo: new FormControl(''),
noteDetail: new FormControl(''),
noteDetailVal: new FormControl(''), …Run Code Online (Sandbox Code Playgroud)