Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:01,520 --> 00:00:03,850
Now that we have a better idea of what the module system is.
2
00:00:03,860 --> 00:00:06,770
Let's figure out how we can generate a new module.
3
00:00:06,770 --> 00:00:11,810
We're gonna generate modules by using the angular CLIA the general command is right here.
4
00:00:11,840 --> 00:00:15,940
So energy Generate Module and then the name of our module.
5
00:00:16,100 --> 00:00:21,950
We can also use a little shortcut which would be N G G and then in the G stands for generate N stands
6
00:00:21,950 --> 00:00:23,430
for module.
7
00:00:23,620 --> 00:00:28,720
We're going to add on the dash dash routing flag to our commands that we're going to use to generate
8
00:00:28,720 --> 00:00:30,370
a couple of modules right now.
9
00:00:30,400 --> 00:00:37,000
The reason that we're adding on dash dash routing is that we're generating some rounded modules because
10
00:00:37,000 --> 00:00:43,150
we want to make sure that we only show say this content right here when a user is at a root of slash
11
00:00:43,150 --> 00:00:44,110
elements.
12
00:00:44,110 --> 00:00:46,280
We only want to show this collections module.
13
00:00:46,300 --> 00:00:51,820
Any time that a user is at slash collections and so on for the other pages as well.
14
00:00:51,820 --> 00:00:57,850
If we were instead generating a shared or small widget module so something that defined some reusable
15
00:00:57,850 --> 00:01:05,200
components then we would not add on that dash dash routing flag because we do not want to tie some reusable
16
00:01:05,200 --> 00:01:07,740
components to some specific routes.
17
00:01:07,960 --> 00:01:13,850
We only make use of dash dash routing when we are creating a routed or routing module.
18
00:01:13,900 --> 00:01:15,370
Let's go back over to our command line.
19
00:01:15,370 --> 00:01:20,470
We're going to generate four different modules using this command one for each page of our application
20
00:01:22,200 --> 00:01:23,370
the back in my command line.
21
00:01:23,430 --> 00:01:27,860
I'm going to change into my new ops directory the one that we've just generated.
22
00:01:27,900 --> 00:01:34,560
Just a moment ago and then inside of here we're going to run four separate times and G G and then M
23
00:01:35,060 --> 00:01:38,220
and then the name of our module the first one.
24
00:01:38,280 --> 00:01:49,910
Once again we're going to call elements all do elements dash dash routing all then repeat that command
25
00:01:50,060 --> 00:01:51,920
of N G G M.
26
00:01:52,030 --> 00:01:55,050
Next one is elections
27
00:02:02,150 --> 00:02:06,350
then use.
28
00:02:06,540 --> 00:02:13,000
And then finally one last one though inside of the mockup right here we call this the modules page.
29
00:02:13,050 --> 00:02:19,390
This is essentially showing some stuff from the module section of semantic UI rather than calling it
30
00:02:19,390 --> 00:02:21,270
modules because I would be really confusing.
31
00:02:21,280 --> 00:02:23,500
We're gonna call it simply mods instead.
32
00:02:23,530 --> 00:02:28,720
So IMO D.S. mods just a little bit different just to make sure it's clear that hey this is a module
33
00:02:28,720 --> 00:02:36,960
in the world of angular and this thing is like the mods feature of semantic UI we'll do n g g m mods
34
00:02:37,140 --> 00:02:39,140
dash dash routing as well.
35
00:02:40,990 --> 00:02:41,240
OK.
36
00:02:41,280 --> 00:02:43,440
So there's are four different modules.
37
00:02:43,470 --> 00:02:47,640
Let's now open up our code editor inside of our project directory and take a look at what was created
38
00:02:47,640 --> 00:02:50,770
for us though between the last video and this one.
39
00:02:50,770 --> 00:02:54,290
I've gone ahead and open up my editor inside of here.
40
00:02:54,290 --> 00:02:58,690
I'm going to find my source directory and then the app folder now inside the app folder.
41
00:02:58,700 --> 00:03:02,090
I'll see it there are now or sub folders inside there.
42
00:03:02,100 --> 00:03:07,250
I've got collections elements mods and views all the different modules we create by default are going
43
00:03:07,250 --> 00:03:10,650
to be placed inside this app folder.
44
00:03:10,660 --> 00:03:14,920
Now we can open up any one these folders and we'll see that two different files have been created for
45
00:03:14,920 --> 00:03:15,870
us.
46
00:03:15,880 --> 00:03:17,830
First off is the module file.
47
00:03:17,830 --> 00:03:23,080
So for example used up module dot T.S. and inside of here we'll see some code that looks very similar
48
00:03:23,080 --> 00:03:25,510
to what we have inside of our app module.
49
00:03:25,510 --> 00:03:29,890
We've taken a look at the app module once or twice but I haven't really discussed the code inside there.
50
00:03:29,890 --> 00:03:34,570
This is about every module we create is going to look very similar too much just like what you see right
51
00:03:34,570 --> 00:03:35,460
here.
52
00:03:35,500 --> 00:03:38,510
The only difference between them is on a different configuration options.
53
00:03:38,600 --> 00:03:43,510
We're going to provide to this energy module directive and we're going to discuss what these configuration
54
00:03:43,510 --> 00:03:46,260
options mean in just a moment.
55
00:03:46,290 --> 00:03:50,640
Now the other file that you'll notice that was generated inside of each of these directories is the
56
00:03:50,790 --> 00:03:58,750
something dash routing dot module file for example views dash routing dot module dot t yes.
57
00:03:58,880 --> 00:04:08,330
The purpose of this file right here is to serve as our routing module when we added on that dash dash
58
00:04:08,360 --> 00:04:14,990
routing flag to that command angular decided to also create for us automatically these routing files.
59
00:04:15,020 --> 00:04:20,240
So these routing files are the result of adding on dash dash routing to that energy generate command
60
00:04:21,110 --> 00:04:23,180
inside of each of these routing files.
61
00:04:23,180 --> 00:04:28,880
You and I are going to add in some number of configuration rules to say hey whenever a user goes to
62
00:04:28,940 --> 00:04:34,910
some routes like let's say slash tattoos we want to show some component that is defined inside of our
63
00:04:34,910 --> 00:04:42,930
module for example inside of our use dash routing module file we might write out some configuration
64
00:04:42,930 --> 00:04:50,320
inside of here to say whenever a user comes here show the user something from our views page like say
65
00:04:50,370 --> 00:04:55,950
the statistics component or the item list component and so on that's what's going on with those two
66
00:04:55,950 --> 00:04:57,240
different files.
67
00:04:57,240 --> 00:05:03,870
Again when we use that dash dash routing command you're generating both a routing and a routed module
68
00:05:03,870 --> 00:05:06,410
simultaneously OK.
69
00:05:06,440 --> 00:05:08,710
So now you've seen this generation in action.
70
00:05:08,750 --> 00:05:09,880
Let's take a pause right here.
71
00:05:09,880 --> 00:05:13,640
We're gonna come back the next video we're going to a quick discussion on routing in general instead
72
00:05:13,640 --> 00:05:16,550
of angular and get a better idea of how this stuff really works.
7634
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.