From the course: Angular: API Communication and Authentication
Unlock the full course today
Join today to access over 22,500 courses taught by industry experts or purchase this course individually.
Using @angular/http to retrieve contacts, part 2 - Angular Tutorial
From the course: Angular: API Communication and Authentication
Using @angular/http to retrieve contacts, part 2
- [Narrator] In our template we can now render a list of contact components using the ngfor directive. Giving each contact object as input to a contact component. This component doesn't exist yet so let's generate it using the angular CLI. We open up our terminal and we can generate an e component using an ng generate component contact. Let's add to that component's html file. We will give each contact a card look using styles from sematic ui. We will need the image and the source property will be set to the photo url property. This operator that you see here tells angular that if contact is null it won't set the source property. This is useful so that we won't start getting any 404's. We also need the content which will hold the name and the address. At the bottom of this card we will display the phone. This will render information from the input to our component. Open up the component file and let's import the same contact interface that we imported previously. This component will…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
GET route for the API4m 55s
-
POST route for the API3m 54s
-
Using @angular/http to retrieve contacts, part 13m 8s
-
Using @angular/http to retrieve contacts, part 23m 52s
-
Creating a new route for adding a new contact6m 12s
-
Using ngForm for form submission2m 49s
-
Writing the onSubmit() function4m 16s
-
-
-
-
-