Sujeet Raman

Sujeet Raman

  • 859
  • 927
  • 357.5k

Text box is not binding in angular 2 html

May 4 2017 9:22 AM
 this is my ts class and am unable to bind to the html.obnect is getting in data[0]
but unable to bind 
 
 
 
 
GetTax(MV_ID){
console.log('Getting user now.');var MNameres="",MCoderes="",MCoderesw="";
this._httpService.getTaxes(MV_ID).subscribe(
data =>{this.getvalues = JSON.stringify(data),
MNameres= data[0][" MNameres"];//here value getting
MCoderes=data[0]["MCoderes"];
MCoderesw=data[0]["MCoderesw"];
},
error=>alert(error),
()=>console.log(

this.TaxName=MNameres,//not getting value
this.EffectiveDate=MCoderes,//not getting value
this.ExpDate=MCoderesw),//not getting value
);
}
 
 
 
my html
 

<div>
<button class="btn btn-primary" (click)=" GetTax(MV_ID)">GetValues</button>
</div>
<div class="col-md-2 col-md-offset-3"style="float:left" >
TaxName:<input type="text" [(ngModel)]="TaxName"/>{{Taxes.TaxName}}<br>&nbsp;
<p>Version Start Time <input type="date" [(ngModel)]="EffectiveDate" />{{Taxes.EffectiveDate}} <br>&nbsp; </p>
<p>&nbsp;</p>
<p>Version Start Time <input type="date" [(ngModel)]="ExpDate" />{{Taxes.ExpDate}}<br>&nbsp;</p>
<p>&nbsp;</p>
<button class="btn btn-primary" (click)="SaveTaxValue(MV_ID,M_ID,EffectiveDate,ExpDate,GroupType,VariableType,TaxName,CalculationType,IsActive,CreatedOn)">SUBMIT</button>
<button class="btn btn-primary">CANCEL</button>
</div>


 

Answers (5)