Find out how to retrieve optional route parameters from the URL of your Angular 2 application on page load and when your users refresh the page.
- [Instructor] Optional route parameters…are retrieved using our instance of activated route.…The activated route instance gives us access…to the params property we can access by referencing,…this.activatedroute.params in our ngOnInIt method.…this.activatedroute.params in our ngOnInIt method.…The params property returns an observable…we can subscribe to just like we did…we can subscribe to just like we did…with the URL property earlier in this course.…The params observable returns an object of key value pairs.…
And will access the filter property we need,…using a turnary operator and our storage key property.…We'll reference the this.filter property…and assign it to the params,…bracket this.storageKey value.…bracket this.storageKey value.…But only,…if this.storageKey exists.…if this.storageKey exists.…If the storageKey property we're looking for does not exist…we can safely assume there is no filter…and we can set our filter property…to an empty string instead.…
If we look at our website now,…we'll see that not only do we filter the list of users…
- 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.