当我使用ngModel时尝试进行比较时出现错误

时间:2019-05-23 11:01:15

标签: angular

<div class="form-group col-md-3">
                    <label>Sales Office<span style="color: red">*</span> 
</label><br />
                    <p-multiSelect [options]="salesOfficeOptions" 
[(ngModel)]="getLeader.salesOffices" 
                     (click) = "getAllSalesOfficeByUnit()" 
formControlName="selectedOffice" ></p-multiSelect>
                </div>
            </div>

            <div class="form-group col-md-3 border-right">
                        <label>District</label><br/>
                        <input type="text" 
[(ngModel)]="getLeader.districts" formcontrolname="district" pInputText 
id="districts" 
                        class="form-control cust_inputField" ></div>
export class Leader implements OnInit{
 getLeader:any={};

ngOnInit(){
    console.log("leadeship"+this.role);
    this.getLeadershipForm = this.builder.group({
        selectedRegions: ['', Validators.required],
        selectedUnits: ['', Validators.required],
        selectedOffice: ['', Validators.required],
        district: [''],
        stateCode: [''],
        count:[''],
        enableRadio: [''],

    })
 }
}

我有2个字段,一个工作正常,但在下面一个字段出现diff''错误,当我删除ngModel时工作正常。我也想在第二个上添加ngModel

0 个答案:

没有答案