Join Alexander Zanfir for an in-depth discussion in this video Send a post from Angular to the endpoint, part of MEAN Stack and MongoDB: Development Techniques.
- [Voiceover] In this video, we will be creating…an HTTP post method with Angular…that will send our message to Node.…Let's begin by going over to our main controller.js…which is located in the source app main folder…and now that we're there, we can take a look…at the post message function we created…in the last Node video.…So now let's add the HTTP post call inside it.…So instead of our console.log, we use $http.post…and we'll supply the URL.…
And for the second parameter, we'll send our json object…and we'll just have a placeholder object now…with a message property that says hello.…As you can see here, we are using the Angular HTTP service…in order to post our data to the following URL.…So we will need reference to HTTP.…Let's inject the HTTP into our constructor…and pass its reference to a class property we create.…And we'll do that with this.$http…and we'll send it to the reference we just passed in.…
And so now if we copy this,…we can replace HTTP with this.$http.…So let's go ahead and test that out.…Back inside our browser, let's go ahead…
- Installing and setting up your MEAN toolset
- Making an Angular post form
- Sending posts
- Displaying messages
- Creating a registration form
- Saving users
- Associating users with posts
- Authenticating users at login
Skill Level Intermediate
2. Message Posting
3. Display Messages
Save a user with Mongo13m 26s
5. Logging In
Next steps2m 5s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.