TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
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
>
<
p
>
Version Start Time
<
input
type
=
"date"
[(
ngModel
)]=
"EffectiveDate"
/>
{{Taxes.EffectiveDate}}
<
br
>
</
p
>
<
p
>
</
p
>
<
p
>
Version Start Time
<
input
type
=
"date"
[(
ngModel
)]=
"ExpDate"
/>
{{Taxes.ExpDate}}
<
br
>
</
p
>
<
p
>
</
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
>
Reply
Answers (
5
)
How to bind textbox in angular 2
CRUD in Angular 2