Angular2~6 [(ngModel)] 与 formControlName 共存

sku-info.html

updateOn:'blur'

itemName:{{itemName}}

childId:{{form.value.childId}}

sku-info.ts

import {Component} from '@angular/core';
import {FormGroup,FormBuilder} from '@angular/forms';

@Component({
  selector:"sku-info",
  templateUrl:'./sku-info.html'
})
export class SkuInfoComponent {
  form:FormGroup;
  itemName:string = "测试商品测试商品测试商品";
  constructor(private fb:FormBuilder){}
  ngOnInit(){
    this.form = this.fb.group({
      itemId:[332532532],
      childId:[2424]
    })
  }
}

深圳 天之骄子

你可能感兴趣的:(Angular2~6 [(ngModel)] 与 formControlName 共存)