Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:01,440 --> 00:00:01,730
All right.
2
00:00:01,740 --> 00:00:04,390
Let's go through a solution to this next step.
3
00:00:04,390 --> 00:00:07,410
Do we need to change the content that gets displayed to the user.
4
00:00:07,410 --> 00:00:13,080
Specifically we want to replace this default screen with some basic elements for our application.
5
00:00:13,080 --> 00:00:16,950
Now recall that anytime that we say that we want to change some content that gets displayed to the user
6
00:00:17,190 --> 00:00:20,530
that's always a sign that we want to change a component template.
7
00:00:20,620 --> 00:00:26,850
So let's open up our code Ed right now and inside of our source app folder we're going to find our app
8
00:00:26,910 --> 00:00:28,980
component dot H2 UML file.
9
00:00:29,070 --> 00:00:31,740
This is our app component template.
10
00:00:31,740 --> 00:00:33,480
I will highlight everything inside of here.
11
00:00:33,570 --> 00:00:36,840
So this is all the pre generated default landing page stuff.
12
00:00:36,870 --> 00:00:44,340
You can delete it or then replace it with some elements to show that basic stuff on the screen at the
13
00:00:44,340 --> 00:00:45,480
very top all display.
14
00:00:45,480 --> 00:00:54,520
And each one that says typing challenge that's kind of like our big title.
15
00:00:54,540 --> 00:01:00,400
Next up we need some place to put the randomly generated text though right underneath the H1.
16
00:01:00,510 --> 00:01:10,810
I'll put in a paragraph element that says something like randomly generated text should go here.
17
00:01:10,830 --> 00:01:17,770
Then after that we need to show our input and then finally we need to show a success message at the
18
00:01:17,770 --> 00:01:18,750
very bottom.
19
00:01:18,790 --> 00:01:22,690
I'll put in an H1 down there as well and I'll say success
20
00:01:25,600 --> 00:01:25,880
OK.
21
00:01:25,920 --> 00:01:28,630
So hopefully you got something like this put together as well.
22
00:01:28,690 --> 00:01:32,540
We go back over to our application we'll see those elements appear.
23
00:01:32,730 --> 00:01:34,370
They look kind of ugly right now.
24
00:01:34,470 --> 00:01:38,910
You and I are going to add in a little bit of styling to this right away for a lot of the.
25
00:01:38,910 --> 00:01:43,410
Yes s in each team l structure we're going to go over that stuff together because I don't really expect
26
00:01:43,410 --> 00:01:48,510
you to guess at the exact class names that I want you to use to end up with something that looks like
27
00:01:48,570 --> 00:01:50,680
our original mockup over here.
28
00:01:50,850 --> 00:01:55,740
Let's figure out some additional class names and elements to throw inside of here just to get a little
29
00:01:55,740 --> 00:02:01,950
bit of styling the first off we're going to wrap everything inside this template with another div that
30
00:02:01,950 --> 00:02:10,130
has a class of container and I'll make sure I close that off at the bottom and inside there we're going
31
00:02:10,130 --> 00:02:18,750
to wrap everything once again with another div that has a class of columns and is Dash centered and
32
00:02:18,750 --> 00:02:25,560
I'll close that div off at the bottom then we're going to wrap all this once again with a div that has
33
00:02:25,560 --> 00:02:37,700
a class of box alum and is dash one dash third and once again I'll close that div off at the bottom.
34
00:02:37,770 --> 00:02:43,930
Now if I save this right away and go back over we'll see that we essentially just got thing that looks
35
00:02:43,930 --> 00:02:44,280
like that.
36
00:02:44,310 --> 00:02:46,350
So everything is going to wrapped into a card.
37
00:02:46,480 --> 00:02:51,610
It's centered in the very middle and it's got kind of this one quarter with where it's really only one
38
00:02:51,610 --> 00:02:58,100
quarter of the available width on the screen let's now add some additional styling to the each one the
39
00:02:58,100 --> 00:03:05,000
input that paragraph element and so on they'll find the H1 element we're going to give a class of title
40
00:03:05,390 --> 00:03:14,820
and has text centered I'm going to give the paragraph element a class of has dash text dash centered
41
00:03:14,880 --> 00:03:15,360
as well
42
00:03:19,120 --> 00:03:28,010
on the input elements I'll give it a wrapping div that has a class of field and to the input itself
43
00:03:28,430 --> 00:03:35,050
I'll give it a class of input and then finally for our success message at the bottom I'm going to wrap
44
00:03:35,050 --> 00:03:42,160
that as well but the div of class box and as dash next dash centered
45
00:03:45,510 --> 00:03:50,640
I'll put it closing div on the other side and then finally last thing here on the H1 itself I'll give
46
00:03:50,640 --> 00:03:54,570
it a class of title OK.
47
00:03:54,620 --> 00:03:55,660
There we go.
48
00:03:55,690 --> 00:03:57,060
The double check your spelling inside of here.
49
00:03:57,070 --> 00:03:59,600
Because I did just add in a lot of additional stuff.
50
00:03:59,620 --> 00:04:01,500
Make sure you've got the exact same text.
51
00:04:01,510 --> 00:04:07,980
I do now if I flip back over I should see something it looks closer to this definitely a little bit
52
00:04:07,980 --> 00:04:11,170
closer to our original mockup OK.
53
00:04:11,260 --> 00:04:12,550
That w looks a little bit better.
54
00:04:12,590 --> 00:04:16,510
I'm going to zoom this back in just remember I always run my browser really far zoomed in.
55
00:04:16,610 --> 00:04:19,800
So you're going to start to see a lot of stuff that looks a little bit different than what you have
56
00:04:19,830 --> 00:04:21,520
on your screen.
57
00:04:21,590 --> 00:04:25,150
Now the next thing we're going to do let's bring up a diagram.
58
00:04:25,400 --> 00:04:31,220
We need to randomly generate a sentence to show to a user when our application first starts up and loads
59
00:04:31,220 --> 00:04:32,360
up inside the browser.
60
00:04:32,360 --> 00:04:35,810
We need to somehow randomly generate a sentence to show to the user.
61
00:04:35,810 --> 00:04:40,880
The chances are we should generate that sentence and maybe just as kind of a guess here as a little
62
00:04:40,880 --> 00:04:43,850
tip maybe we should assign that as a prop..
63
00:04:43,850 --> 00:04:48,860
One of the components inside our application and then we should try to get that randomly generated sentence
64
00:04:48,920 --> 00:04:53,190
visible on the screen probably inside of that paragraph element right here.
65
00:04:53,660 --> 00:04:58,820
So we'll probably replace that hard coded text right there with whatever are randomly generated sentence
66
00:04:58,880 --> 00:05:00,950
is.
67
00:05:00,980 --> 00:05:05,550
Now I do not expect you to figure out how to randomly generate some Latin sentence.
68
00:05:05,580 --> 00:05:07,850
We're going to go over that initial step together.
69
00:05:07,850 --> 00:05:12,380
Right now I'm going to show you a little library that we're going to use to randomly generate a sentence
70
00:05:12,380 --> 00:05:13,720
for us.
71
00:05:13,750 --> 00:05:14,110
OK.
72
00:05:14,150 --> 00:05:19,700
So to randomly generate a sentence we're going to flip over to a new browser tab and navigate to NPM
73
00:05:19,700 --> 00:05:27,330
Jess dot com this is a listing of all the different packages that we can easily stall into our project.
74
00:05:27,480 --> 00:05:33,880
We're going to do a search for a very particular package called Baker bakery is a really popular package
75
00:05:33,880 --> 00:05:39,850
that is used to just generate random data essentially fake data and so it makes it really easy to test
76
00:05:39,850 --> 00:05:45,570
out applications and whatnot by throwing in a ton of fake data to it though we're going to use this
77
00:05:45,570 --> 00:05:51,790
package just to generate one single random sentence to show to the user we're going to first install
78
00:05:51,790 --> 00:05:56,590
this as a dependency into our project and then we'll come back over to the documentation and get a better
79
00:05:56,590 --> 00:05:59,540
idea of how to actually use it.
80
00:05:59,590 --> 00:05:59,950
OK.
81
00:05:59,990 --> 00:06:03,140
I'm gonna go back over to my terminal in order to install this.
82
00:06:03,230 --> 00:06:05,390
Once again I'm inside of a second terminal window.
83
00:06:05,390 --> 00:06:08,630
Here's my original one here's my second terminal window.
84
00:06:08,630 --> 00:06:12,640
Again it's inside of my typing project directory inside there.
85
00:06:12,640 --> 00:06:20,110
I'll do an npm install maker install that module while that goes I can go backwards.
86
00:06:20,110 --> 00:06:24,750
The documentation and we'll figure out how to use this to generate a sentence.
87
00:06:24,910 --> 00:06:32,180
I'm going to scroll down for just a little bit and then I'll find demo right here on this demo page.
88
00:06:32,200 --> 00:06:36,410
We can take a look at all the different types of data that we can generate I'm going to scroll down
89
00:06:36,440 --> 00:06:41,270
a little bit on this initial page they land on and we'll see something it says API reference right here.
90
00:06:41,560 --> 00:06:47,060
So inside of API reference we're going to find a link to Lorem right there.
91
00:06:47,090 --> 00:06:48,310
I'll go ahead and click on it
92
00:06:51,450 --> 00:06:55,490
the inside of the Lorem sub module of the faker package.
93
00:06:55,510 --> 00:07:01,870
You can use this thing to generate a random word random words so multiple written into words a full
94
00:07:01,870 --> 00:07:05,530
sentence sentences a paragraph paragraphs and so on.
95
00:07:05,530 --> 00:07:10,870
You get the idea that for you and I we're going to use this sentence function and that's going to generate
96
00:07:10,900 --> 00:07:16,440
a string that looks like that right there though it will be perfect for a little typing test now that
97
00:07:16,440 --> 00:07:19,690
we've installed this module and we've seen the function we want to use.
98
00:07:19,740 --> 00:07:23,970
Let's go back over to our Ed we're gonna find our app component because that's where we're going to
99
00:07:23,970 --> 00:07:30,010
initially use this thing and I'll show you really quickly how to call this sentence method.
100
00:07:30,110 --> 00:07:35,980
It's a back inside my Ed. I'm going to find my app component here it is right here and then at the very
101
00:07:35,980 --> 00:07:41,380
top right underneath our angular core imports I'm gonna add in another import and we're going to get
102
00:07:41,380 --> 00:07:49,430
the Lorem sub module from the baker module.
103
00:07:49,450 --> 00:07:56,190
Now if you see a little underlined right here that says hey cannot find a declaration file then no problem.
104
00:07:56,300 --> 00:08:01,850
If you see that little warning we will flip back over to our terminal and you can install a second little
105
00:08:01,850 --> 00:08:06,060
package npm install at types slash Baker.
106
00:08:06,230 --> 00:08:12,440
You only have to do that if you see that little underline this additional package we're installing has
107
00:08:12,440 --> 00:08:17,240
some information about the faker module in it specifically telling typescript which is what we are writing
108
00:08:17,240 --> 00:08:21,930
right here about the different types of variables and functions available to us inside of the failure
109
00:08:21,980 --> 00:08:23,540
package.
110
00:08:23,560 --> 00:08:30,310
Now if we wanted to generate a random sentence we would call Lorem dot sentence like so that's gonna
111
00:08:30,340 --> 00:08:34,230
give us back a string of characters representing the random sentence.
112
00:08:34,540 --> 00:08:38,500
That's how we generate the random sentence I'm going to delete that and now I'm going to leave it up
113
00:08:38,500 --> 00:08:43,510
to you to figure out what we actually want to do with that sentence that we just achieve step one right
114
00:08:43,510 --> 00:08:47,310
here and it's up to you to figure out the next two it we'll take a pause here.
115
00:08:47,320 --> 00:08:50,350
Go ahead and give those next to a shot and I'll see you in just a moment.
12772
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.