Learn how to display an array property using ngFor.
- [Instructor] Sometimes you need to loop…through an iterable, which is a collection of data…like an array, or an array of objects.…In these cases, Angular provides…you with the ngFor directive.…ngFor works by allowing you to repeat a template…with each item of an iterable.…The basic syntax is to declare an ngFor attribute…and inside of the quotes bind each iterable…to a local template variable.…So let's give it a shot in our own project.…First we have to create an array or an array of objects,…we already have this object here from the previous video…so let's turn it into an array of objects real quickly,…but first, if you're using Visual Studio Code,…you can hit Control + B and that will hide the sidebar.…
Okay, so we have our team's object here,…let's real quickly restructure this…and we'll put two other teams and save it.…Now, next let's go ahead and use…the ngFor directive in the template.…
Let's get rid of our h1 and instead…we'll put an unordered list, so ul,…and inside of it, we'll put our list item.…This is where we add the ngFor directive.…
- How components work
- Defining HTML templates
- Defining CSS
- Class binding and style binding
- Property binding and event binding
- Creating routes for navigation
Skill Level Intermediate
1. Getting Up and Running with Angular
2. Templating Basics
3. Data Binding
5. Tying It All Together
- 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.