Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,830 --> 00:00:06,150
In the last video we customize our card components by communicating some information from the app down
2
00:00:06,150 --> 00:00:08,370
to the three individual children.
3
00:00:08,550 --> 00:00:10,180
We went through those steps rather quickly.
4
00:00:10,200 --> 00:00:15,510
So in this video I want to show you a more formalized diagram and help you understand the exact five
5
00:00:15,510 --> 00:00:17,370
steps that are always going to go through.
6
00:00:17,410 --> 00:00:23,580
Anytime you want to communicate some information from a parent component down to a child component you
7
00:00:23,630 --> 00:00:28,430
are going to go through these series of five steps any time that you want to customize a child component.
8
00:00:29,030 --> 00:00:31,030
OK so let's walk through these.
9
00:00:31,080 --> 00:00:36,780
Everything began with no one right here where we found the parent component template and inside there
10
00:00:36,810 --> 00:00:42,930
we found where we were creating the child component in our case the app component is the parent and
11
00:00:42,930 --> 00:00:48,690
the card is the child and we wanted to communicate some information from the parent to the child.
12
00:00:48,990 --> 00:00:55,460
Again we found the parent components template that is app component not HD e-mail and inside there.
13
00:00:55,470 --> 00:01:01,950
We found where we were creating the child component that is the app dash card after that.
14
00:01:01,950 --> 00:01:07,290
We then decided on some property name the piece of information that we wanted to use to communicate
15
00:01:07,290 --> 00:01:09,180
from the parent to the child.
16
00:01:09,180 --> 00:01:15,300
So in our case we had said that the name of this thing right here this piece of information we wanted
17
00:01:15,300 --> 00:01:18,600
to share from the parent to the child was going to be title.
18
00:01:18,600 --> 00:01:24,370
We also decided on property names of immaterial username content for the other things as well.
19
00:01:27,180 --> 00:01:32,820
After that we wrote in some new property binding syntax to that child component and inside there.
20
00:01:32,820 --> 00:01:37,470
We specify the data that we wanted to pass down that was right here.
21
00:01:37,500 --> 00:01:41,310
This is our property binding syntax though inside the left hand side.
22
00:01:41,310 --> 00:01:46,650
We put down the property name that we decided upon and then on the right hand side we put in the information
23
00:01:46,650 --> 00:01:49,620
that we wanted to pass down to our card component.
24
00:01:49,710 --> 00:01:56,540
Again that is step number three then in Step number four we open up the child components class file
25
00:01:56,840 --> 00:02:00,300
because we had to declare an input property inside there.
26
00:02:00,300 --> 00:02:02,600
Remember the idea behind step number four right here.
27
00:02:02,600 --> 00:02:05,630
We kind of took a quick quick look at this example over here.
28
00:02:05,900 --> 00:02:11,870
We had said that the input element inside of your normal l normal browser behavior knows how to take
29
00:02:11,900 --> 00:02:16,900
a value property and use it to customize how that thing is displayed on the screen.
30
00:02:16,970 --> 00:02:20,200
We have to do the same thing for our child component as well.
31
00:02:20,240 --> 00:02:26,030
We have to teach our child component how to accept a given property and how to make use of it.
32
00:02:26,070 --> 00:02:31,720
We found our component our child can Sunni or her child class file so many files to work with here.
33
00:02:31,820 --> 00:02:35,370
Here's our child class file as the card component class.
34
00:02:35,450 --> 00:02:41,880
Inside there we designated an input property that we imported the input decorator.
35
00:02:41,900 --> 00:02:43,230
That's what this thing is called right here.
36
00:02:43,270 --> 00:02:49,610
A decorator the input decorator tells angular that this property is going to be provided by the parent
37
00:02:49,610 --> 00:02:50,570
component.
38
00:02:50,720 --> 00:02:52,460
But this is kind of like where we are teaching.
39
00:02:52,490 --> 00:03:00,990
The card component how to accept some piece of information then in step number five we open up the child
40
00:03:00,990 --> 00:03:05,730
components template file and we referenced that input property that we had declared during step number
41
00:03:05,730 --> 00:03:09,990
four that is inside of our card component HMO file.
42
00:03:09,990 --> 00:03:15,340
We made use of the property that was passed down by using that interpolation syntax right there.
43
00:03:16,610 --> 00:03:16,900
OK.
44
00:03:16,940 --> 00:03:18,690
That's the five steps you're going to go through.
45
00:03:18,690 --> 00:03:23,120
Anytime they want to communicate from a parent to a child really quickly just to give you kind of a
46
00:03:23,180 --> 00:03:24,410
different perspective on this.
47
00:03:24,410 --> 00:03:28,940
I want to go through the same thing very quickly using this diagram as well just to give you something
48
00:03:29,000 --> 00:03:30,570
a little bit more visual.
49
00:03:30,710 --> 00:03:36,560
The inside of our app template we write out the component that we wanted to create which was app card
50
00:03:38,970 --> 00:03:43,830
and inside there we put down the property binding syntax and we specified the property that we wanted
51
00:03:43,830 --> 00:03:44,510
to pass down.
52
00:03:45,120 --> 00:03:51,120
We said we wanted to give the title property down to our card class that we set inside of those square
53
00:03:51,120 --> 00:03:51,570
brackets.
54
00:03:51,570 --> 00:03:54,150
Title is us at 0.
55
00:03:54,170 --> 00:04:00,570
That title that looked up the first post inside the post array tied to our app components it pulled
56
00:04:00,570 --> 00:04:05,940
off the title property and it passed that down as a piece of information to the card class instance
57
00:04:06,820 --> 00:04:14,140
something like title is neat tree with an angular created a new instance of our card class.
58
00:04:14,150 --> 00:04:18,890
That said this thing is going to have a title property because it was passed down the string of neat
59
00:04:18,890 --> 00:04:20,270
tree from the parent.
60
00:04:20,480 --> 00:04:27,700
That thing was going to be initialized to neat tree then our clerk heard class instance added its own
61
00:04:27,700 --> 00:04:34,420
template and that template used the interpolation syntax referred to that title property that had been
62
00:04:34,420 --> 00:04:37,840
defined on the component.
63
00:04:37,870 --> 00:04:39,680
So again same series of steps right here.
64
00:04:39,690 --> 00:04:43,970
Just kind of like a diagram or visual format as opposed to the series of steps.
65
00:04:43,980 --> 00:04:48,900
So I would encourage you to remember this list right here as we're going to go through these steps many
66
00:04:48,960 --> 00:04:50,760
many times inside this course.
67
00:04:50,920 --> 00:04:55,590
Anytime that we want to communicate some information from a parent to a child component.
68
00:04:55,590 --> 00:04:55,930
OK.
69
00:04:55,980 --> 00:04:57,570
So now we understand this a little bit better.
70
00:04:57,570 --> 00:04:58,880
Let's take a pause right here.
71
00:04:58,890 --> 00:05:04,240
We still have to finish up a little bit of code inside of our app component template typically.
72
00:05:04,260 --> 00:05:08,820
We need to make sure that we communicate the image URL username and content to those three or so to
73
00:05:08,820 --> 00:05:11,180
me those two other app cards as well.
74
00:05:11,200 --> 00:05:12,900
Quick pause and I'll see you in just a minute.
8080
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.