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
Navjot Angra
NA
489
250.7k
How Can I post Data(Json object) from Angular 2 to Web api?
Jul 13 2018 1:05 AM
app.component.ts
Step
1:
Json Data
this.objsearch=[
{ "Key": "FirstName", "value": this.firstName },
{ "Key": "MiddleName", "value": this.middleName },
{ "Key": "fatherName ", "value": this.fatherName },
]
Method To call service Serice class:
this.ServiceObject.saveData(JSON.stringify(this.objsearch))
.subscribe(response => (this._param) = response);
}
Service.ts class
public
_saveDataURL
= 'http://localhost:53915/api/ComapnyAndProduct/DeleteItem';
saveData(objSearch: any)
{
return this._http.post(this.
_saveDataURL
,objSearch)
.map((response: Response) => response.json());
}
Web api
[HttpPost]
public IHttpActionResult DeleteItem([FromUri]Mregistration objSearch)
{
return ok();
}
Reply
Answers (
2
)
variable value is not updating
How to upload image in server through CKEditor?