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
864
927
352.9k
how to bind api model state message(error msg) in typescript
May 31 2018 5:26 AM
Hi i have a save funtion in my angular app.if save is failed i need to show error message that returning from api.what i tried is..
in my service;
private
handleError(error: Response) {
return
Observable.
throw
(error.text());
}
save(id: any) {
.map(res => <
string
[]>res.json())
.
catch
(
this
.handleError);
}
component.ts:
save() {
this
.Service.save(
this
.id)
.subscribe(response => {
this
.res= response;
},
(error) => {
this
.errorMsg = error
alert(
this
.errorMsg)
});
}
/final output am getting in alert : [{ "Message": null, "ModelState": [{ "Message": "enter valid range, the range is conflicting with range 8.00 and 17.00" }] }]
but i need to show only "enter valid range, the range is conflicting with range 8.00 and 17.00"
can anyone help me?
Reply
Answers (
7
)
Cannot read property 'write' of undefined
ERROR ReferenceError: $ is not defined at angular-datata