具有WCF服务的角度为5的数据绑定 [英] Databind in angular 5 with WCF service

查看:98
本文介绍了具有WCF服务的角度为5的数据绑定的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

绑定角度下拉时遇到问题



当我点击(GetPlanDates())下拉列表它必须从服务加载值,并能够选择值( GetPlanDate($ event))





角度结果的Wcf响应:



result({Response:Success!,dates:[20180723,20180724,20180725,20180726]})



我尝试过:



I have problem while binding angular dropdown

When I click(GetPlanDates()) dropdown It has to load values from service, and able to select the value (GetPlanDate($event))


Wcf response for angular result:

result({"Response":"Success!","dates":["20180723","20180724","20180725","20180726"]} )

What I have tried:

<div class="form-group">
              <label class="control-label col-sm-3" for="PlanDate">Plan Date :</label>
              <div class="col-lg-3">
                <select class="form-control" [(ngModel)]="model.PlanDateS" name="PlanDates" #name="ngModel" required (change)="GetPlanDate($event)"
                  (click)="GetPlanDates()">
                  <option [ngValue]="terri" *ngFor="let terri of PlanDates" >{{terri.PlanDates}}</option>
                </select>
              </div>
            </div>





TS代码:





TS code:

PlanDates:any[];
  public GetPlanDates() {
    this._EnvironmentService.LoadTerritoryDatesforBuilding(this.model, this.Server, this.BldgMnemonic).subscribe(result => {
      this.response = result;
      if (this.response.Response.match("Success!")) {
        this.PlanDates=this.response.dates;
      }
      else {
        this.isTerritoryDates = true;
      }
    }, err => console.error(err => {
      console.log('Error While Getting PlanDates');    }));
  }

推荐答案

event))





角度结果的Wcf响应:



结果({响应:成功!,日期:[20180723, 20180724,20180725,20180726]})



我尝试过:



event))


Wcf response for angular result:

result({"Response":"Success!","dates":["20180723","20180724","20180725","20180726"]} )

What I have tried:

<div class="form-group">
              <label class="control-label col-sm-3" for="PlanDate">Plan Date :</label>
              <div class="col-lg-3">
                <select class="form-control" [(ngModel)]="model.PlanDateS" name="PlanDates" #name="ngModel" required (change)="GetPlanDate(


事件)
(click)= GetPlanDates() < span class =code-keyword>>
< option [ngValue] = terri * ngFor = 让terri of PlanDates > {{terri.PlanDates}} < / 选项 >
< / 选择 >
< / div >
< / div >
event)" (click)="GetPlanDates()"> <option [ngValue]="terri" *ngFor="let terri of PlanDates" >{{terri.PlanDates}}</option> </select> </div> </div>





TS代码:





TS code:

PlanDates:any[];
  public GetPlanDates() {
    this._EnvironmentService.LoadTerritoryDatesforBuilding(this.model, this.Server, this.BldgMnemonic).subscribe(result => {
      this.response = result;
      if (this.response.Response.match("Success!")) {
        this.PlanDates=this.response.dates;
      }
      else {
        this.isTerritoryDates = true;
      }
    }, err => console.error(err => {
      console.log('Error While Getting PlanDates');    }));
  }


这篇关于具有WCF服务的角度为5的数据绑定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆