From the course: Angular: Creating and Hosting a Full-Stack Site

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Connect the New Listing page

Connect the New Listing page

From the course: Angular: Creating and Hosting a Full-Stack Site

Start my 1-month free trial

Connect the New Listing page

- [Instructor] So here's what adding server requests to our new listing page will look like. Like we've done with our other pages, we're going to start off by adding a new method to our listing service. So let's go back to our listing service and the method we're going to add is going to be called create listing and it's going to take three arguments. The name of the new listing, the description of the new listing, which is going to be a string as well and the price of the new listing, which will be a number and this method is going to return an observable that calls it's callback with a listing type and then inside this method, we just have to say return this.http.post. Remember that we have to use a post request since we want to send along this extra information when we create our new listing and this post request is going to respond to the listing and the URL we want to send this request to is going to be…

Contents