Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:01,450 --> 00:00:06,300
We've now got one card visible on the screen so we still have to show those other two cards.
2
00:00:06,400 --> 00:00:10,120
Bonus video we're going to take a look at a couple of different diagrams to explain how we might show
3
00:00:10,120 --> 00:00:14,270
those other two cards in a angular style fashion.
4
00:00:14,280 --> 00:00:14,620
OK.
5
00:00:14,680 --> 00:00:17,510
So a couple of diagrams though in this first diagram right here.
6
00:00:17,530 --> 00:00:23,240
I want to explain some very simplistic way and not a very good angular approach that we might just try
7
00:00:23,240 --> 00:00:25,120
to show those other two cards.
8
00:00:25,270 --> 00:00:30,940
So a very simplistic way would be to open up our app component HDMI file inside there we can take all
9
00:00:30,940 --> 00:00:35,330
the each HTML that we just wrote for The Tree card and duplicate it twice down.
10
00:00:35,740 --> 00:00:40,150
And then in each of those duplicated segments of each team out we could start to change some of the
11
00:00:40,150 --> 00:00:45,430
text and make sure that one reflects some properties of say the mountains card and the other is for
12
00:00:45,430 --> 00:00:46,130
biking.
13
00:00:46,350 --> 00:00:50,750
Some of the words duplicate HDL and just change some stuff inside there.
14
00:00:50,770 --> 00:00:55,690
This is really not a very good approach because we're talking about taking some H2 structure and just
15
00:00:55,690 --> 00:00:59,080
willy nilly duplicating it throughout our application.
16
00:00:59,080 --> 00:01:01,990
What would happen if we decided to add in more cards.
17
00:01:01,990 --> 00:01:06,060
Well if we decided to add in more cards we would just be duplicating more HCM.
18
00:01:06,430 --> 00:01:11,380
If we then decided to change the structure of our card like change the HDL we would have to go back
19
00:01:11,380 --> 00:01:15,220
to each and every one of these snippets and change each one by hand.
20
00:01:15,220 --> 00:01:21,500
Definitely not very good but rather than duplicating all that HCM l we're going to create something
21
00:01:21,500 --> 00:01:27,560
called a component to make this little bit of H2 and all that we're trying to create more reusable in
22
00:01:27,620 --> 00:01:32,750
nature is the thing I want you to take away here is that any time that we are duplicating each team
23
00:01:32,760 --> 00:01:37,550
l It is frequently a sign that we might want to try to create a component.
24
00:01:37,550 --> 00:01:42,470
There are other ways in angular to reduce each small duplication but definitely thinking about creating
25
00:01:42,470 --> 00:01:44,720
a component is a good place to get started.
26
00:01:45,580 --> 00:01:50,710
Now we've kind of been having the term component float around quite a bit in this course so far but
27
00:01:50,900 --> 00:01:54,910
in this video I want to really explain to you what a component is.
28
00:01:55,160 --> 00:01:57,090
We're going to go over a couple notes here.
29
00:01:57,110 --> 00:01:58,740
I know there's a lot of texture on the screen.
30
00:01:58,760 --> 00:02:02,840
We're going to go through this rather quickly because we're going to see attributes of each of these
31
00:02:02,840 --> 00:02:07,520
different notes very quickly inside this application that we're working on OK.
32
00:02:07,580 --> 00:02:08,990
A couple of notes.
33
00:02:09,180 --> 00:02:14,130
First off all angular applications we create are going to be assembled out of different components that
34
00:02:14,130 --> 00:02:19,440
we make in other words the vast majority of your time working on an angular application is going to
35
00:02:19,440 --> 00:02:25,290
be spent creating different components and then assembling them together to actually make a useful application
36
00:02:26,410 --> 00:02:31,900
each component that you and I create is going to be designed to implement or show one single thing or
37
00:02:31,900 --> 00:02:35,260
really a widget for the user on the screen.
38
00:02:35,290 --> 00:02:41,260
Let me show you an example right away though here on the left hand side we have what looks like a little
39
00:02:41,260 --> 00:02:47,530
dropdown kind of button we might create a component to encapsulate all the behavior of this little widget
40
00:02:47,530 --> 00:02:48,910
right here.
41
00:02:48,910 --> 00:02:53,520
We might also create a component to say show a series of navigation tabs to a user.
42
00:02:53,710 --> 00:02:57,950
We might also create more complex components like maybe something called a repository component.
43
00:02:58,030 --> 00:03:02,880
It shows details about some get repository or something like that to the user as well.
44
00:03:03,050 --> 00:03:07,750
So in general we try to create components to show single widgets to a user.
45
00:03:07,750 --> 00:03:13,240
We try to make these components as reusable as possible and then to build an actual angular application.
46
00:03:13,240 --> 00:03:19,420
We're going to spend all of our time taking these components and assembling them together in some fashion.
47
00:03:19,520 --> 00:03:26,380
Next note though whenever we create a component it's going to wrap up all the each CML and all the code
48
00:03:26,440 --> 00:03:33,000
all the CSX required to make that one little widget work correctly though very soon you and I are going
49
00:03:33,000 --> 00:03:38,820
to as you'd probably guess create a new component meant to display an individual card to the user.
50
00:03:38,910 --> 00:03:43,200
When we create that component we're going to write out all this assess all the each team all all the
51
00:03:43,200 --> 00:03:45,590
code required to make this thing work correctly.
52
00:03:45,690 --> 00:03:50,460
Inside of the irrelevant component files.
53
00:03:50,600 --> 00:03:54,730
Next up a component can be reused multiple times in the same application.
54
00:03:54,740 --> 00:03:59,660
So in general you and I tried to make components that are as reusable as possible and then we tried
55
00:03:59,660 --> 00:04:04,000
to configure those components to work in slightly different ways.
56
00:04:04,130 --> 00:04:10,010
For example for our application we're going to create one reusable component called a card component
57
00:04:10,150 --> 00:04:13,670
that's going to really just represent all this stuff right here.
58
00:04:13,670 --> 00:04:19,010
We're then going to reuse that component three times one to show the tree stuff one from mountain and
59
00:04:19,010 --> 00:04:20,190
one for biking.
60
00:04:20,240 --> 00:04:28,130
The one component that gets reused Next up components can be nested or shown inside of each other.
61
00:04:28,230 --> 00:04:29,550
Let's go back to that example.
62
00:04:29,640 --> 00:04:32,530
We looked at just over here at these three different components.
63
00:04:32,550 --> 00:04:37,650
Let's imagine that we took these three different components and we wanted to form an actual application
64
00:04:37,680 --> 00:04:38,440
out of them.
65
00:04:38,670 --> 00:04:44,700
Maybe something that looks like this right here though on the left hand side maybe we'd have the tabs
66
00:04:44,700 --> 00:04:49,830
for navigation and then this repositories thing and then for some reason a dropdown button on the top
67
00:04:49,830 --> 00:04:56,040
right inside the build something like this we would take these three different components we would create
68
00:04:56,100 --> 00:05:00,260
one copy of each of them and then to show them to the user on the screen.
69
00:05:00,360 --> 00:05:05,640
We would nest all of them in something called the app components and so we would end up with a structure
70
00:05:05,640 --> 00:05:07,270
that looks like this right here.
71
00:05:07,350 --> 00:05:10,280
This is what we call a component hierarchy diagram.
72
00:05:10,290 --> 00:05:15,420
This means that at the very top we have an app component that is responsible for showing our entire
73
00:05:15,420 --> 00:05:20,810
application to the user and then inside that component we have nested three others.
74
00:05:20,810 --> 00:05:26,940
We have nested the dropdown tabs and repository and nesting these different components together is what
75
00:05:26,940 --> 00:05:30,130
gets them visible on the screen.
76
00:05:30,140 --> 00:05:35,660
Now the app component right here at the very top as you might guess is actually that app stuff that
77
00:05:35,660 --> 00:05:39,760
we've been working on inside of our projects so far this app thing.
78
00:05:39,770 --> 00:05:43,960
Well I know the name really implies it the app thing is a component in itself.
79
00:05:44,180 --> 00:05:48,630
So we've already been working with a component quite a bit as we start to add in other components to
80
00:05:48,620 --> 00:05:49,580
our application.
81
00:05:49,580 --> 00:05:54,800
We are going to nest them inside of this app component that we already have to get our new components
82
00:05:54,800 --> 00:06:00,140
visible on the screen at just one or two more notes here.
83
00:06:00,150 --> 00:06:04,810
The next up like we just said every app has a component called app component and it's always going to
84
00:06:04,810 --> 00:06:06,410
be the most parents component.
85
00:06:06,430 --> 00:06:11,290
In other words that thing gets shown by default inside of our application and then in order to show
86
00:06:11,290 --> 00:06:16,690
other content to the user we're going to place other components inside of the app component.
87
00:06:16,690 --> 00:06:19,050
We're going to do that right away for this very first application.
88
00:06:19,060 --> 00:06:22,510
So you'll see a good example this almost immediately.
89
00:06:22,540 --> 00:06:22,830
All right.
90
00:06:22,830 --> 00:06:23,880
And final note here.
91
00:06:24,020 --> 00:06:28,470
Every component we create has its own component class which we've already worked with quite a bit.
92
00:06:28,580 --> 00:06:34,400
It's own component templates which we've worked with it's own components the file and a SPECT file as
93
00:06:34,400 --> 00:06:34,970
well.
94
00:06:35,090 --> 00:06:38,270
We haven't really discussed testing or spec files at all.
95
00:06:38,270 --> 00:06:43,280
That's something that we definitely are going to get into quite a bit throughout this course Okay that's
96
00:06:43,280 --> 00:06:43,460
it.
97
00:06:43,460 --> 00:06:47,520
Some high level notes on components let's take a pause right here.
98
00:06:47,540 --> 00:06:52,400
When we come back the next video we're gonna create our own very first component meant to represent
99
00:06:52,490 --> 00:06:57,800
these different cards that we are showing to the user and use it to show the tree on the screen.
100
00:06:57,890 --> 00:06:59,600
Let's take care of that in just a moment.
11296
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.