Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:01,330 --> 00:00:06,280
We can now show a correctly styled card on the screen but we're only showing one right now as a quick
2
00:00:06,280 --> 00:00:11,710
reminder if we go into our app component HMO file we can't duplicate that app Card element down a couple
3
00:00:11,710 --> 00:00:16,540
of times and every single time we show app dash card that's going to create a new card component and
4
00:00:16,540 --> 00:00:17,910
displayed on the screen.
5
00:00:18,310 --> 00:00:23,010
If i duplicate that twice and then save the file and go back over to my browser on I'll see it.
6
00:00:23,000 --> 00:00:24,750
Three cards appear.
7
00:00:24,760 --> 00:00:26,900
We can definitely show this component multiple times.
8
00:00:26,980 --> 00:00:33,180
But now every single component has the same image same title same content same user name and so on.
9
00:00:33,230 --> 00:00:37,240
So in this video we're going to figure out how we can show multiple copies of this component and then
10
00:00:37,270 --> 00:00:40,330
customize each and every one to do so.
11
00:00:40,330 --> 00:00:43,780
We're going to first open up our app component inside there.
12
00:00:43,840 --> 00:00:49,990
We're going to define a new property called posts this post property is going to be an array of objects
13
00:00:50,500 --> 00:00:55,560
each object inside that array is going to represent data that we want to display on a single card.
14
00:00:55,680 --> 00:01:01,990
The we're calling a post the data that we want to show inside of a card you'll notice that inside of
15
00:01:01,990 --> 00:01:06,820
each of these objects I'm only printing out kind of a title property right here meant to represent the
16
00:01:06,850 --> 00:01:12,430
title on each different card we create those objects are also gonna have some other properties as well
17
00:01:12,760 --> 00:01:18,130
such as the link to the image we want to display for each card the user name and the content.
18
00:01:18,130 --> 00:01:23,810
I'm only showing title on this diagram right here just to keep the diagram easy to read and understand.
19
00:01:24,130 --> 00:01:28,960
Once you create this array of posts we're then going to create a variety of different card components
20
00:01:29,650 --> 00:01:31,250
into each card component.
21
00:01:31,300 --> 00:01:37,000
We're going to pass down a set of configuration options for example to this first card.
22
00:01:37,000 --> 00:01:41,610
We're going to pass down a title out of that array right there of neat tree.
23
00:01:41,620 --> 00:01:43,320
We're then going to set up this card component.
24
00:01:43,360 --> 00:01:50,390
So it takes that title and uses it to customize itself the step one in setting all this up is to define
25
00:01:50,390 --> 00:01:54,110
this post's array as an array of objects on our app component.
26
00:01:54,110 --> 00:01:56,010
Let's do that right now.
27
00:01:56,090 --> 00:01:58,280
I'm going to change back over to my editor.
28
00:01:58,470 --> 00:02:00,200
I'm going to find my app component.
29
00:02:00,250 --> 00:02:02,780
Dot yes file inside there.
30
00:02:02,780 --> 00:02:08,450
There's already one existing property called title that was added in automatically when we first generated
31
00:02:08,480 --> 00:02:09,640
our project.
32
00:02:09,740 --> 00:02:11,410
We don't need that title property at all.
33
00:02:11,420 --> 00:02:18,390
So I'm just going to delete it and inside of here I'm going to create the array of objects.
34
00:02:18,470 --> 00:02:21,920
So again each of these objects represents one single post.
35
00:02:21,920 --> 00:02:26,060
We want to take each post and pass it down to a card component.
36
00:02:26,110 --> 00:02:32,340
I'm going to give this first one a title of neat tree mostly gonna add in all the other properties that
37
00:02:32,340 --> 00:02:34,620
we need to represent a card as well.
38
00:02:34,620 --> 00:02:39,690
So in total I think that there are a couple of different properties we really need here.
39
00:02:39,690 --> 00:02:43,700
First off we need some title property to represent the title of each card.
40
00:02:43,710 --> 00:02:46,830
We also need the user name for each post.
41
00:02:46,980 --> 00:02:52,020
We're going to call that a property called User Name the content on here will give a property name of
42
00:02:52,020 --> 00:02:52,800
content.
43
00:02:52,890 --> 00:02:58,230
And then finally the image at the very top or the link to it will call the image you are El.
44
00:02:58,430 --> 00:03:02,120
We're going to add each of these properties into each of those three objects.
45
00:03:02,130 --> 00:03:04,270
We're going to put into this post array.
46
00:03:04,410 --> 00:03:10,520
So in other words we're going to do a little bit of typing right now though after title I'm also gonna
47
00:03:10,550 --> 00:03:19,250
put in image your URL and I'm going to make this the assets tree dot j peg I'll then do what user name
48
00:03:19,920 --> 00:03:20,620
which I'll make.
49
00:03:20,620 --> 00:03:23,370
How about nature and content which will be.
50
00:03:23,370 --> 00:03:26,880
I saw this neat tree today.
51
00:03:26,900 --> 00:03:32,960
Now we can copy paste this object down twice or the other two posts we want to create I'll paste it
52
00:03:32,960 --> 00:03:40,560
down once and then twice and on the second and third objects I'm going to go through an update a couple
53
00:03:40,560 --> 00:03:44,160
of these different properties on title on the second one.
54
00:03:44,190 --> 00:03:46,720
I'm going to change that to snowy mountain.
55
00:03:46,980 --> 00:03:52,080
I'll change the image you are L to mountain dot JPEG because remember that is the name of our image
56
00:03:52,080 --> 00:04:01,780
inside of our assets directory I'll change the user name to about mountain lover and content.
57
00:04:01,800 --> 00:04:02,820
Change that to.
58
00:04:03,060 --> 00:04:09,320
Here is a picture of a snowy mountain.
59
00:04:09,460 --> 00:04:12,620
And then finally we can update the properties on a third object as well.
60
00:04:12,850 --> 00:04:20,180
I'll change the title to mountain biking remember our image you are all in this case it's gonna be the
61
00:04:20,180 --> 00:04:27,700
assets directory we want the biking dot JPEG image out of there we'll do assets slash biking dot j peg
62
00:04:28,500 --> 00:04:37,280
we'll make the user name biking one two two two then finally I did some biking today Okay so we now
63
00:04:37,280 --> 00:04:43,580
have this array of objects on our app component so now we want to take each of those objects we want
64
00:04:43,580 --> 00:04:48,550
to pass each of them down to a separate instance of our card component.
65
00:04:48,590 --> 00:04:52,190
Now again this diagram right here just a little bit misleading because I'm not showing all the properties
66
00:04:52,190 --> 00:04:56,510
inside those objects but essentially want to take all the properties inside of each object and pass
67
00:04:56,510 --> 00:04:58,310
them down to each card.
68
00:04:58,310 --> 00:05:00,290
Let's figure out how we do that in the next video.
7456
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.