Find out how to get, set, and delete fragments in the URL of your Angular 2 application based on user input and when your users refresh the page.
- [Voiceover] URL fragments are an alternative…to query strings for use with discretionary…data like our user list filter.…URL fragments are technically part…of the routing path in angular.…So depending in your specific use case…URL fragments may be the best solution.…The API's for URL fragments…and query strings are very similar.…The major difference being that query strings…are always key value pairs while a…URL fragment is a string value with no key.…Let's start by updating our on filter method to set…a URL fragment instead of a query string whenever a user…types texts into the filter input in our UI.…
We do this by using the fragment property in place of…the query params property in the navigation extras object.…If the fragment property expects a string so we'll set…our filter property directly as the value of our fragment.…When we reload the page we'll see that the URL now appends…a URL fragment with whatever we type into the input.…To clear the URL fragment when…a user clicks the clear button,…we remove the fragment property entirely…
- 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.