Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:01,570 --> 00:00:06,070
Now that we have generated our project I want to have a quick discussion on the module system inside
2
00:00:06,070 --> 00:00:06,980
of angular.
3
00:00:07,040 --> 00:00:13,540
So first off what is a module module is an optional feature that we can use inside of angular to better
4
00:00:13,540 --> 00:00:15,920
organized code inside of our project.
5
00:00:15,940 --> 00:00:18,930
I use the term optional because it really really is.
6
00:00:19,060 --> 00:00:21,420
You do not have to use the module system instead of angular.
7
00:00:21,420 --> 00:00:26,710
If you do not want to you're going to find that it's a pretty useful system to make use of and the vast
8
00:00:26,710 --> 00:00:32,040
vast majority of production angular applications out there do in fact use the module system.
9
00:00:32,060 --> 00:00:34,120
What is the module system all about.
10
00:00:34,120 --> 00:00:38,920
Well take a look at this little imaginary application right here on the left hand side is a To Do List
11
00:00:38,920 --> 00:00:43,310
feature and on the right hand side is a current weather feature.
12
00:00:43,540 --> 00:00:49,520
We create a separate module for each distinct feature that we expect our application to have though
13
00:00:49,540 --> 00:00:55,210
in our case or in this imaginary application we've got two distinct features one for two dos one for
14
00:00:55,210 --> 00:01:02,380
whether we would create a two do module and a weather module and then inside of each of these modules
15
00:01:02,830 --> 00:01:07,450
we would place all the different components all the different directives and all the different types
16
00:01:07,510 --> 00:01:13,300
that are needed to implement that very specific feature decided to do module I might create something
17
00:01:13,300 --> 00:01:18,700
called The To Do List component it would create that content right there and then inside the weather
18
00:01:18,700 --> 00:01:23,410
module I might create a weather show component it would implement the current weather display right
19
00:01:23,410 --> 00:01:30,980
there when we start making use of modules there are actually five different types of modules and you
20
00:01:30,980 --> 00:01:35,870
do not need to memorize these different types of modules at all you don't have to memorize this list
21
00:01:36,380 --> 00:01:40,590
the only reason I'm showing you this diagram right here is because you're going to see a lot of documentation
22
00:01:40,610 --> 00:01:43,520
and blog posts that refer to these different types of modules.
23
00:01:43,700 --> 00:01:48,860
But again at the end of the day you really do not have to memorize these the first kind of module that
24
00:01:48,860 --> 00:01:54,320
we're going to work with is a domain module or a domain module is very similar to what we just discussed
25
00:01:54,350 --> 00:01:59,330
over here a domain module is a module that's going to wrap up all the different components that are
26
00:01:59,330 --> 00:02:04,420
needed to implement one single feature of our application.
27
00:02:04,470 --> 00:02:08,760
The second kind of module that we're going to see is something called a routed module.
28
00:02:08,760 --> 00:02:11,430
This is very very similar to a domain module.
29
00:02:11,430 --> 00:02:17,910
The only difference is that the components inside of here are tied to some different routes and remember
30
00:02:17,970 --> 00:02:22,820
a route in the world of angular means that anytime that user goes to some specific you url.
31
00:02:22,830 --> 00:02:28,470
So like a route of slash to do is or something like that you will try to show them some specific component
32
00:02:29,710 --> 00:02:32,690
a routing module is very very similar in nature.
33
00:02:32,750 --> 00:02:36,450
The routing module is what actually defines the very specific routing rules.
34
00:02:36,470 --> 00:02:42,040
So the thing that actually says well yeah if we go to slash to dos showed a To Do List component.
35
00:02:42,320 --> 00:02:46,910
The reason that I say that understanding these module types is not super important is that right away
36
00:02:47,270 --> 00:02:51,180
you might be kind of confused about the difference between these first three.
37
00:02:51,320 --> 00:02:53,820
Yes they are very similar in nature.
38
00:02:53,840 --> 00:02:58,730
At the end of the day all three of them really do have a distinct purpose and we can really kind of
39
00:02:58,790 --> 00:03:00,860
whittle down the definition of each of them.
40
00:03:00,920 --> 00:03:07,420
But again at the end of the day they really are kind of similar in nature next to on here are a little
41
00:03:07,420 --> 00:03:08,720
bit more different.
42
00:03:08,960 --> 00:03:11,740
The Fourth we have something called a service module.
43
00:03:11,740 --> 00:03:15,000
This is a module that defines some different services.
44
00:03:15,130 --> 00:03:19,790
Remember a service inside of angular is something that manages or fetches data.
45
00:03:20,130 --> 00:03:21,880
And then finally a widget module.
46
00:03:21,940 --> 00:03:26,830
This is something that defines some set of reusable components that are intended to be used between
47
00:03:26,890 --> 00:03:33,770
multiple other modules inside of our application most applications that we build are going to have at
48
00:03:33,770 --> 00:03:37,710
least a domain module and a widget module.
49
00:03:37,710 --> 00:03:43,250
I want to say most I'm talking about most production applications or courses in service to me for applications
50
00:03:43,250 --> 00:03:44,410
inside of this course.
51
00:03:44,420 --> 00:03:48,930
We're generally going to be working out of just one single module the app module.
52
00:03:49,050 --> 00:03:53,170
Though many applications we're gonna work on from here towards the end of the course we're just going
53
00:03:53,170 --> 00:03:54,800
to work with one single module.
54
00:03:54,800 --> 00:03:59,660
But in general as you start to work with production applications you're going to see at least a domain
55
00:03:59,660 --> 00:04:02,370
module and a widget one though.
56
00:04:02,380 --> 00:04:04,770
How does this all apply to our application.
57
00:04:04,780 --> 00:04:10,180
Well for you and I for this application we're working on we're going to create at least or separate
58
00:04:10,180 --> 00:04:15,460
modules even though we are discussing these things we're saying oh yeah these are reusable components
59
00:04:15,730 --> 00:04:21,430
we're going to pretend that each page that we're looking at here so that elements page elections views
60
00:04:21,460 --> 00:04:27,480
and modules we're going to pretend that each of these represents one distinct feature that we're going
61
00:04:27,480 --> 00:04:34,020
to create one module of the elements module a second one called collections a third called views in
62
00:04:34,020 --> 00:04:38,940
a fourth called modules or maybe we can think of a better name so that we don't have to call it like
63
00:04:38,940 --> 00:04:44,520
a module module because that's really confusing that's what we're gonna do inside of our application.
64
00:04:44,520 --> 00:04:49,260
And again this is all about getting a better idea of how to encapsulate or kind of a wrap up together
65
00:04:49,620 --> 00:04:54,840
all the different components related to one feature inside of our app okay.
66
00:04:54,900 --> 00:04:56,160
Let's take a quick pause right here.
67
00:04:56,160 --> 00:05:00,270
When we come back the next video we're going to take a look at how we can very easily generate a new
68
00:05:00,270 --> 00:05:02,580
module using the angular CLIA.
7994
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.