Find out how to debounce your user's input in your Angular 2 application to reduce network traffic and keep bandwith available for your server.
- [Instructor] If we look at the network tab…in our developer tools,…we'll see that our application…sends a network request with every keystroke.…To reduce our network traffic…and only make requests when the user stops typing,…let's import the debounceTime method…from the RxJS library into our user list component.…We do this by creating a new import statement…at the top of our component…and importing directly from rxjs/add/operator/debounceTime.…
DebounceTime is a chainable method…that discards emitted values…if they arrive sooner than a specified time,…passing only the most recent value along…to the following method in the chain.…Our user input is an excellent use case…for debounceTime because we can discard…any values created while a user is typing…and only pass along the value once typing has stopped.…In our ngOnInit method,…we'll add the new debounceTime method…between subject and subscribe.…
DebounceTime accepts a single argument,…and integer representing the number…of milliseconds that must pass between emitted values…
- Overview of data storage options
- Saving and retrieving data from the browser
- Setting routes in the URL
- Using query strings and fragments instead of routes
- Saving and retrieving data from a server
- Working with user input
- Using JSONP instead of HTTP
- Why writing custom services is important
- Writing custom services for working with browsers and servers
Skill Level Intermediate
1. Getting Started
Application overview1m 39s
2. Data Storage Options
3. Storing Data in the Browser
4. Storing Data on a Server
5. Writing Custom Services
- 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.